stores/validation: export types

This commit is contained in:
Chika 2022-10-26 19:07:46 +03:00
parent e6bb6a4d6f
commit 4d5fff51b1
5 changed files with 10 additions and 10 deletions

View File

@ -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,

View File

@ -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';

View File

@ -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({

View File

@ -6,8 +6,6 @@ type Params = {
err_title: string;
};
export type RemoveError = () => void;
export default class Validation {
params: Params;
messages: Set<string>;

View File

@ -0,0 +1,6 @@
export type ValidationParams = {
invalid: boolean;
message: string;
};
export type RemoveError = () => void;