chore: redirect to login page if api reports unauthorized in admin page (#12726)

### What problem does this PR solve?

Auto redirect to login page if API reports `401: Unauthroized` in ANY
**Admin** page.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Jimmy Ben Klieve
2026-01-20 18:58:13 +08:00
committed by GitHub
parent 1c65f64bda
commit 9ebbc5a74d

View File

@ -49,6 +49,7 @@ request.interceptors.response.use(
authorizationUtil.removeAll();
history.push(Routes.Admin);
window.location.reload();
} else if (data?.code && data.code !== 0) {
notification.error({
message: `${i18n.t('message.hint')}: ${data?.code}`,
@ -80,6 +81,7 @@ request.interceptors.response.use(
authorizationUtil.removeAll();
history.push(Routes.Admin);
window.location.reload();
} else if (data?.code && data.code !== 0) {
notification.error({
message: `${i18n.t('message.hint')}: ${data?.code}`,