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:
Zhichang Yu
2024-11-05 11:02:31 +08:00
committed by GitHub
parent 339639a9db
commit 185c6a0c71
53 changed files with 1458 additions and 1470 deletions

View File

@ -176,7 +176,7 @@ export const useEditDialog = () => {
async (dialogId?: string) => {
if (dialogId) {
const ret = await fetchDialog(dialogId);
if (ret.retcode === 0) {
if (ret.code === 0) {
setDialog(ret.data);
}
}
@ -393,7 +393,7 @@ export const useSendNextMessage = (controller: AbortController) => {
controller,
);
if (res && (res?.response.status !== 200 || res?.data?.retcode !== 0)) {
if (res && (res?.response.status !== 200 || res?.data?.code !== 0)) {
// cancel loading
setValue(message.content);
console.info('removeLatestMessage111');
@ -421,7 +421,7 @@ export const useSendNextMessage = (controller: AbortController) => {
true,
conversationId,
);
if (data.retcode === 0) {
if (data.code === 0) {
setConversationIsNew('');
const id = data.data.id;
// currentConversationIdRef.current = id;
@ -541,7 +541,7 @@ export const useRenameConversation = () => {
is_new: false,
});
if (ret.retcode === 0) {
if (ret.code === 0) {
hideConversationRenameModal();
}
},
@ -551,7 +551,7 @@ export const useRenameConversation = () => {
const handleShowConversationRenameModal = useCallback(
async (conversationId: string) => {
const ret = await fetchConversation(conversationId);
if (ret.retcode === 0) {
if (ret.code === 0) {
setConversation(ret.data);
}
showConversationRenameModal();