21 lines
455 B
TypeScript
21 lines
455 B
TypeScript
import type { ObservableSet } from 'mobx';
|
|
import { observable } from 'mobx';
|
|
import type { RemoveError } from './types';
|
|
|
|
export default class ValidationHelper {
|
|
errors: ObservableSet<RemoveError>;
|
|
|
|
constructor() {
|
|
this.errors = observable.set();
|
|
}
|
|
|
|
add = (removeError: RemoveError) => {
|
|
this.errors.add(removeError);
|
|
};
|
|
|
|
removeErrors = () => {
|
|
this.errors.forEach((removeError) => removeError());
|
|
this.errors.clear();
|
|
};
|
|
}
|