stores/validation: export types
This commit is contained in:
parent
e6bb6a4d6f
commit
4d5fff51b1
@ -2,7 +2,7 @@ import type { ApolloClient } from '@apollo/client';
|
||||
import type { QueryClient } from '@tanstack/react-query';
|
||||
import { reaction } from 'mobx';
|
||||
import type RootStore from 'stores/root';
|
||||
import type { RemoveError } from 'stores/validation';
|
||||
import type { RemoveError } from 'stores/validation/types';
|
||||
|
||||
export default function validationReactions(
|
||||
store: RootStore,
|
||||
|
||||
@ -8,7 +8,7 @@ import { shift } from 'radash';
|
||||
import type { CalculationOptions } from 'stores/calculation/options/types';
|
||||
import type RootStore from 'stores/root';
|
||||
import type { Row } from 'stores/tables/payments/types';
|
||||
import type { RemoveError } from 'stores/validation';
|
||||
import type { RemoveError } from 'stores/validation/types';
|
||||
import { difference } from 'tools/array';
|
||||
import { makeDisposable } from 'tools/mobx';
|
||||
import * as seasonsConstants from './lib/seasons-constants';
|
||||
|
||||
@ -6,15 +6,11 @@ import type { BaseOption } from 'Elements/types';
|
||||
import { observable } from 'mobx';
|
||||
import type RootStore from 'stores/root';
|
||||
import Validation from 'stores/validation';
|
||||
import type { ValidationParams } from '../validation/types';
|
||||
import OptionsStore from './options';
|
||||
import StatusStore from './statuses';
|
||||
import ValuesStore from './values';
|
||||
|
||||
type ValidateParams = {
|
||||
invalid: boolean;
|
||||
message: string;
|
||||
};
|
||||
|
||||
export default class CalculationStore {
|
||||
$values: ValuesStore;
|
||||
$status: StatusStore;
|
||||
@ -91,7 +87,7 @@ export default class CalculationStore {
|
||||
return this.element(elementName);
|
||||
},
|
||||
|
||||
validate: ({ invalid, message }: ValidateParams) => {
|
||||
validate: ({ invalid, message }: ValidationParams) => {
|
||||
if (invalid) {
|
||||
if (!this.$validation[elementName]) {
|
||||
this.$validation[elementName] = new Validation({
|
||||
|
||||
@ -6,8 +6,6 @@ type Params = {
|
||||
err_title: string;
|
||||
};
|
||||
|
||||
export type RemoveError = () => void;
|
||||
|
||||
export default class Validation {
|
||||
params: Params;
|
||||
messages: Set<string>;
|
||||
6
stores/validation/types.ts
Normal file
6
stores/validation/types.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export type ValidationParams = {
|
||||
invalid: boolean;
|
||||
message: string;
|
||||
};
|
||||
|
||||
export type RemoveError = () => void;
|
||||
Loading…
x
Reference in New Issue
Block a user