Skip to content

Commit

Permalink
Return promise for axios request and response
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Chong <[email protected]>
  • Loading branch information
aaronchongth committed Oct 3, 2024
1 parent e50baf5 commit 209a798
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/dashboard/src/services/rmf-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ export class DefaultRmfApi implements RmfApi {
},
(error) => {
console.error(`Axios request error: ${error}`);
if (error && error.response && error.response.status && error.response.status === 401) {
window.location.href = '/';
}
return Promise.reject(error);
},
);
axiosInst.interceptors.response.use(
Expand All @@ -126,6 +130,7 @@ export class DefaultRmfApi implements RmfApi {
if (error && error.response && error.response.status && error.response.status === 401) {
window.location.href = '/';
}
return Promise.reject(error);
},
);
const apiConfig = new Configuration({
Expand Down

0 comments on commit 209a798

Please sign in to comment.