Refactor API requests and update component keys

This commit is contained in:
wangqiao
2025-08-21 21:43:46 +08:00
parent 2fe36051f8
commit 0de28e554a
5 changed files with 8 additions and 15 deletions

View File

@ -20,7 +20,7 @@ const useClientRequest = async <T = unknown>(
}
},
onResponse({ response }) {
if (+response.status === 200 && +response._data.code !== 200) {
if (+response.status === 200 && +response._data.code !== 0) {
ElMessage.error(response._data.msg);
}
},

View File

@ -43,6 +43,9 @@ const useServerRequest = async <T>(
endpoint: string,
config?: Omit<FetchOptions, 'method'>
): Promise<T> => {
console.log('config----', config);
// @ts-ignore
return useServerRequest<T>(endpoint, { ...config, method: 'GET' })
}