From 4d5fff51b1701aca013928d59cd05e19be7be27e Mon Sep 17 00:00:00 2001 From: Chika Date: Wed, 26 Oct 2022 19:07:46 +0300 Subject: [PATCH] stores/validation: export types --- process/fingap/reactions/validation.ts | 2 +- process/payments/reactions.ts | 2 +- stores/calculation/index.ts | 8 ++------ stores/{validation.ts => validation/index.ts} | 2 -- stores/validation/types.ts | 6 ++++++ 5 files changed, 10 insertions(+), 10 deletions(-) rename stores/{validation.ts => validation/index.ts} (96%) create mode 100644 stores/validation/types.ts diff --git a/process/fingap/reactions/validation.ts b/process/fingap/reactions/validation.ts index 90966da..b7dfc6d 100644 --- a/process/fingap/reactions/validation.ts +++ b/process/fingap/reactions/validation.ts @@ -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, diff --git a/process/payments/reactions.ts b/process/payments/reactions.ts index ccdb043..c63826f 100644 --- a/process/payments/reactions.ts +++ b/process/payments/reactions.ts @@ -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'; diff --git a/stores/calculation/index.ts b/stores/calculation/index.ts index 10618c4..5fdf7e6 100644 --- a/stores/calculation/index.ts +++ b/stores/calculation/index.ts @@ -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({ diff --git a/stores/validation.ts b/stores/validation/index.ts similarity index 96% rename from stores/validation.ts rename to stores/validation/index.ts index 07ee4b3..235f17d 100644 --- a/stores/validation.ts +++ b/stores/validation/index.ts @@ -6,8 +6,6 @@ type Params = { err_title: string; }; -export type RemoveError = () => void; - export default class Validation { params: Params; messages: Set; diff --git a/stores/validation/types.ts b/stores/validation/types.ts new file mode 100644 index 0000000..f19de2a --- /dev/null +++ b/stores/validation/types.ts @@ -0,0 +1,6 @@ +export type ValidationParams = { + invalid: boolean; + message: string; +}; + +export type RemoveError = () => void;