mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-24 07:26:47 +08:00
Feat: If the user is not logged in, jump to the login page by refreshing. (#5451)
### What problem does this PR solve? Feat: If the user is not logged in, jump to the login page by refreshing. ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -3,9 +3,9 @@ import { ResponseType } from '@/interfaces/database/base';
|
||||
import i18n from '@/locales/config';
|
||||
import authorizationUtil, {
|
||||
getAuthorization,
|
||||
redirectToLogin,
|
||||
} from '@/utils/authorization-util';
|
||||
import { message, notification } from 'antd';
|
||||
import { history } from 'umi';
|
||||
import { RequestMethod, extend } from 'umi-request';
|
||||
import { convertTheKeysOfTheObjectToSnake } from './common-util';
|
||||
|
||||
@ -117,7 +117,7 @@ request.interceptors.response.use(async (response: Response, options) => {
|
||||
duration: 3,
|
||||
});
|
||||
authorizationUtil.removeAll();
|
||||
history.push('/login'); // Will not jump to the login page
|
||||
redirectToLogin();
|
||||
} else if (data?.code !== 0) {
|
||||
notification.error({
|
||||
message: `${i18n.t('message.hint')} : ${data?.code}`,
|
||||
|
||||
Reference in New Issue
Block a user