🐛 fix(api.tsx): add conditional check before calling login function to prevent errors when response data is missing access_token or refresh_token
This commit is contained in:
parent
b832e0844e
commit
a2eadbedb1
1 changed files with 4 additions and 1 deletions
|
|
@ -33,7 +33,10 @@ function ApiInterceptor() {
|
|||
}
|
||||
|
||||
const res = await renewAccessToken(refreshToken);
|
||||
login(res?.data?.access_token, res?.data?.refresh_token);
|
||||
if (res?.data?.access_token && res?.data?.refresh_token) {
|
||||
login(res?.data?.access_token, res?.data?.refresh_token);
|
||||
}
|
||||
|
||||
try {
|
||||
if (error?.config?.headers) {
|
||||
delete error.config.headers["Authorization"];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue