mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Unified API response json schema (#3170)
### What problem does this PR solve? Unified API response json schema ### Type of change - [x] Refactoring
This commit is contained in:
@ -57,7 +57,7 @@ export const useFetchNextChunkList = (): ResponseGetType<{
|
||||
available_int: available,
|
||||
keywords: searchString,
|
||||
});
|
||||
if (data.retcode === 0) {
|
||||
if (data.code === 0) {
|
||||
const res = data.data;
|
||||
return {
|
||||
data: res.chunks,
|
||||
@ -126,11 +126,11 @@ export const useDeleteChunk = () => {
|
||||
mutationKey: ['deleteChunk'],
|
||||
mutationFn: async (params: { chunkIds: string[]; doc_id: string }) => {
|
||||
const { data } = await kbService.rm_chunk(params);
|
||||
if (data.retcode === 0) {
|
||||
if (data.code === 0) {
|
||||
setPaginationParams(1);
|
||||
queryClient.invalidateQueries({ queryKey: ['fetchChunkList'] });
|
||||
}
|
||||
return data?.retcode;
|
||||
return data?.code;
|
||||
},
|
||||
});
|
||||
|
||||
@ -152,11 +152,11 @@ export const useSwitchChunk = () => {
|
||||
doc_id: string;
|
||||
}) => {
|
||||
const { data } = await kbService.switch_chunk(params);
|
||||
if (data.retcode === 0) {
|
||||
if (data.code === 0) {
|
||||
message.success(t('message.modified'));
|
||||
queryClient.invalidateQueries({ queryKey: ['fetchChunkList'] });
|
||||
}
|
||||
return data?.retcode;
|
||||
return data?.code;
|
||||
},
|
||||
});
|
||||
|
||||
@ -179,11 +179,11 @@ export const useCreateChunk = () => {
|
||||
service = kbService.set_chunk;
|
||||
}
|
||||
const { data } = await service(payload);
|
||||
if (data.retcode === 0) {
|
||||
if (data.code === 0) {
|
||||
message.success(t('message.created'));
|
||||
queryClient.invalidateQueries({ queryKey: ['fetchChunkList'] });
|
||||
}
|
||||
return data?.retcode;
|
||||
return data?.code;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user