Added errors store with tests
This commit is contained in:
18
frontend/stores/ErrorsStore.js
Normal file
18
frontend/stores/ErrorsStore.js
Normal file
@@ -0,0 +1,18 @@
|
||||
// @flow
|
||||
import { observable, action } from 'mobx';
|
||||
|
||||
class UiStore {
|
||||
@observable errors = observable.array([]);
|
||||
|
||||
/* Actions */
|
||||
|
||||
@action add = (errorMessage: string): void => {
|
||||
this.errors.push(errorMessage);
|
||||
};
|
||||
|
||||
@action remove = (index: number): void => {
|
||||
this.errors.splice(index, 1);
|
||||
};
|
||||
}
|
||||
|
||||
export default UiStore;
|
||||
Reference in New Issue
Block a user