Refactor API requests and update component keys
This commit is contained in:
@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
@ -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' })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user