addition for prev commit
This commit is contained in:
parent
32b706d563
commit
c26dec1d63
@ -2,8 +2,10 @@
|
||||
import type { ProcessContext } from '../types';
|
||||
import { getTransTax } from '@/api/1c/query';
|
||||
import { selectObjectCategoryTax } from '@/config/default-options';
|
||||
import { STALE_TIME } from '@/constants/request';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import type { QueryFunctionContext } from '@tanstack/react-query';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { reaction } from 'mobx';
|
||||
@ -224,7 +226,7 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
||||
if (OKTMO) {
|
||||
const currentDate = dayjs().utc(false).toDate();
|
||||
|
||||
const { tax, error } = await queryClient.fetchQuery(['1c', 'trans-tax'], (context) =>
|
||||
const request = (context: QueryFunctionContext) =>
|
||||
getTransTax(
|
||||
{
|
||||
OKTMO,
|
||||
@ -234,10 +236,15 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
|
||||
year: leaseObjectYear,
|
||||
},
|
||||
context
|
||||
)
|
||||
);
|
||||
);
|
||||
const { tax, error } = await queryClient.fetchQuery(['1c', 'trans-tax'], request, {
|
||||
staleTime: STALE_TIME,
|
||||
});
|
||||
|
||||
if (!error && tax) {
|
||||
$calculation.element('tbxVehicleTaxInYear').setValue(tax);
|
||||
} else {
|
||||
$calculation.element('tbxVehicleTaxInYear').resetValue();
|
||||
}
|
||||
} else {
|
||||
$calculation.element('tbxVehicleTaxInYear').resetValue();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user