Skip to content

Commit

Permalink
fix(request): TypeError: Cannot read properties of undefined (reading…
Browse files Browse the repository at this point in the history
… 'status') (#225)
  • Loading branch information
Lanfei authored Jan 10, 2025
1 parent 2c17889 commit ad9a8bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/hooks/usePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ export const usePath = () => {
to(pathname().replace(me().base_path, ""))
return
}
ObjStore.setErr(msg)
if (code === undefined || code >= 0) {
ObjStore.setErr(msg)
}
}
}
const pageChange = (index?: number, size?: number, append = false) => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ instance.interceptors.response.use(
// description: error.message,
// });
return {
code: error.response.status,
code: axios.isCancel(error) ? -1 : error.response?.status,
message: error.message,
}
},
Expand Down

0 comments on commit ad9a8bf

Please sign in to comment.