mirror of
https://github.com/serty2005/rmser.git
synced 2026-02-05 03:12:34 -06:00
редактирование и удаление сопоставлений
список накладных с позициями
This commit is contained in:
@@ -36,6 +36,29 @@ export const useOcr = () => {
|
||||
},
|
||||
});
|
||||
|
||||
const deleteMatchMutation = useMutation({
|
||||
mutationFn: (rawName: string) => api.deleteMatch(rawName),
|
||||
onSuccess: () => {
|
||||
message.success('Связь удалена');
|
||||
queryClient.invalidateQueries({ queryKey: ['matches'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['unmatched'] });
|
||||
},
|
||||
onError: () => {
|
||||
message.error('Ошибка при удалении связи');
|
||||
},
|
||||
});
|
||||
|
||||
const deleteUnmatchedMutation = useMutation({
|
||||
mutationFn: (rawName: string) => api.deleteUnmatched(rawName),
|
||||
onSuccess: () => {
|
||||
message.success('Нераспознанная строка удалена');
|
||||
queryClient.invalidateQueries({ queryKey: ['unmatched'] });
|
||||
},
|
||||
onError: () => {
|
||||
message.error('Ошибка при удалении нераспознанной строки');
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
catalog: catalogQuery.data || [],
|
||||
matches: matchesQuery.data || [],
|
||||
@@ -44,5 +67,9 @@ export const useOcr = () => {
|
||||
isError: catalogQuery.isError || matchesQuery.isError,
|
||||
createMatch: createMatchMutation.mutate,
|
||||
isCreating: createMatchMutation.isPending,
|
||||
deleteMatch: deleteMatchMutation.mutate,
|
||||
isDeletingMatch: deleteMatchMutation.isPending,
|
||||
deleteUnmatched: deleteUnmatchedMutation.mutate,
|
||||
isDeletingUnmatched: deleteUnmatchedMutation.isPending,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user