R: Remove redundant type

This commit is contained in:
Ivan 2025-02-22 12:20:47 +03:00
parent 418fbdf195
commit 9f68baadee
6 changed files with 9 additions and 18 deletions

View File

@ -1,7 +1,5 @@
import { queryOptions } from '@tanstack/react-query';
import { type ITargetCst } from '@/features/rsform/backend/types';
import { axiosGet, axiosPatch, axiosPost } from '@/backend/apiTransport';
import { DELAYS, KEYS } from '@/backend/configuration';
import { infoMsg } from '@/utils/labels';
@ -121,10 +119,10 @@ export const ossApi = {
successMessage: infoMsg.changesSaved
}
}),
getPredecessor: (data: ITargetCst) =>
axiosPost<ITargetCst, IConstituentaReference>({
getPredecessor: (cstID: number) =>
axiosPost<{ target: number }, IConstituentaReference>({
schema: schemaConstituentaReference,
endpoint: '/api/oss/get-predecessor',
request: { data: data }
request: { data: { target: cstID } }
})
};

View File

@ -10,6 +10,6 @@ export const useFindPredecessor = () => {
onError: () => client.invalidateQueries()
});
return {
findPredecessor: (target: number) => mutation.mutateAsync({ target: target })
findPredecessor: (target: number) => mutation.mutateAsync(target)
};
};

View File

@ -19,7 +19,6 @@ import {
type IProduceStructureResponse,
type IRSFormDTO,
type IRSFormUploadDTO,
type ITargetCst,
schemaConstituentaBasics,
schemaCstCreatedResponse,
schemaExpressionParse,
@ -117,12 +116,12 @@ export const rsformsApi = {
request: { data: data }
}),
produceStructure: ({ itemID, data }: { itemID: number; data: ITargetCst }) =>
axiosPatch<ITargetCst, IProduceStructureResponse>({
produceStructure: ({ itemID, cstID }: { itemID: number; cstID: number }) =>
axiosPatch<{ target: number }, IProduceStructureResponse>({
schema: schemaProduceStructureResponse,
endpoint: `/api/rsforms/${itemID}/produce-structure`,
request: {
data: data,
data: { target: cstID },
successMessage: response => infoMsg.addedConstituents(response.cst_list.length)
}
}),

View File

@ -54,11 +54,6 @@ export interface IRSFormUploadDTO {
fileName: string;
}
/** Represents target {@link IConstituenta}. */
export interface ITargetCst {
target: number;
}
/** Represents {@link IConstituenta} data, used in creation process. */
export type ICstCreateDTO = z.infer<typeof schemaCstCreate>;

View File

@ -5,7 +5,6 @@ import { useUpdateTimestamp } from '@/features/library';
import { KEYS } from '@/backend/configuration';
import { rsformsApi } from './api';
import { type ITargetCst } from './types';
export const useProduceStructure = () => {
const client = useQueryClient();
@ -28,7 +27,7 @@ export const useProduceStructure = () => {
onError: () => client.invalidateQueries()
});
return {
produceStructure: (data: { itemID: number; data: ITargetCst }) =>
produceStructure: (data: { itemID: number; cstID: number }) =>
mutation.mutateAsync(data).then(response => response.cst_list)
};
};

View File

@ -189,7 +189,7 @@ export function MenuRSTabs() {
}
void produceStructure({
itemID: schema.id,
data: { target: activeCst.id }
cstID: activeCst.id
}).then(cstList => {
if (cstList.length !== 0) {
setSelected(cstList);