Skip to content

Commit

Permalink
feat: 优化接口debug
Browse files Browse the repository at this point in the history
  • Loading branch information
MarleneJiang committed Feb 2, 2023
1 parent 3c40ea8 commit 7ef76b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/utils/useGraphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ export async function useGraphql(query: any) {

const res = await axios(config)
if ('errors' in res.data)
throw new Error(res.data)
throw res
return removeStrapiWrapper(res.data)
}
catch (err: any) {
console.error('API请求错误')
console.error('状态码', err.response.status)
console.error('请求数据', err.config.data)
console.error('错误说明', err.response.data)
console.error('状态码', err?.response.status)
console.error('请求数据', err?.config.data)
console.error('错误说明', err?.response.data)
}
}

0 comments on commit 7ef76b7

Please sign in to comment.