mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +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:
@ -1,12 +1,11 @@
|
||||
import { Authorization } from '@/constants/authorization';
|
||||
import userService from '@/services/user-service';
|
||||
import authorizationUtil from '@/utils/authorization-util';
|
||||
import authorizationUtil, { redirectToLogin } from '@/utils/authorization-util';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { Form, message } from 'antd';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { history } from 'umi';
|
||||
|
||||
export interface ILoginRequestBody {
|
||||
email: string;
|
||||
@ -89,7 +88,7 @@ export const useLogout = () => {
|
||||
if (data.code === 0) {
|
||||
message.success(t('message.logout'));
|
||||
authorizationUtil.removeAll();
|
||||
history.push('/login');
|
||||
redirectToLogin();
|
||||
}
|
||||
return data.code;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user