stores/calculation/validation: show notification
This commit is contained in:
parent
760ef0e078
commit
47fcc67677
8
Elements/notification.ts
Normal file
8
Elements/notification.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/* eslint-disable unicorn/prefer-export-from */
|
||||
import { notification } from 'antd';
|
||||
|
||||
notification.config({
|
||||
placement: 'bottomRight',
|
||||
});
|
||||
|
||||
export default notification;
|
||||
@ -1,5 +1,7 @@
|
||||
/* eslint-disable object-curly-newline */
|
||||
import titles from 'Components/Calculation/config/elements-titles';
|
||||
import type { Elements } from 'Components/Calculation/config/map/values';
|
||||
import notification from 'Elements/notification';
|
||||
import { makeAutoObservable, observable } from 'mobx';
|
||||
import type RootStore from 'stores/root';
|
||||
import type { ElementsErrors, Error } from './types';
|
||||
@ -38,7 +40,11 @@ export default class ValidationStore {
|
||||
this.elementsErrors[elementName]?.splice(errorIndex, 1, error);
|
||||
}
|
||||
|
||||
// TODO: call notification
|
||||
notification.error({
|
||||
key: error.name,
|
||||
message: `Ошибка в поле ${titles[elementName]}`,
|
||||
description: error.text,
|
||||
});
|
||||
|
||||
return () => this.#removeError(elementName, error.name);
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user