mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-31 07:36:46 +08:00
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:
@ -49,6 +49,7 @@ request.interceptors.response.use(
|
|||||||
|
|
||||||
authorizationUtil.removeAll();
|
authorizationUtil.removeAll();
|
||||||
history.push(Routes.Admin);
|
history.push(Routes.Admin);
|
||||||
|
window.location.reload();
|
||||||
} else if (data?.code && data.code !== 0) {
|
} else if (data?.code && data.code !== 0) {
|
||||||
notification.error({
|
notification.error({
|
||||||
message: `${i18n.t('message.hint')}: ${data?.code}`,
|
message: `${i18n.t('message.hint')}: ${data?.code}`,
|
||||||
@ -80,6 +81,7 @@ request.interceptors.response.use(
|
|||||||
|
|
||||||
authorizationUtil.removeAll();
|
authorizationUtil.removeAll();
|
||||||
history.push(Routes.Admin);
|
history.push(Routes.Admin);
|
||||||
|
window.location.reload();
|
||||||
} else if (data?.code && data.code !== 0) {
|
} else if (data?.code && data.code !== 0) {
|
||||||
notification.error({
|
notification.error({
|
||||||
message: `${i18n.t('message.hint')}: ${data?.code}`,
|
message: `${i18n.t('message.hint')}: ${data?.code}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user