mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
feat: fixed the issue that some PDF documents could not be displayed on the chunk list page in small screens and logout (#105)
* feat: logout * feat: fixed the issue that some PDF documents could not be displayed on the chunk list page in small screens
This commit is contained in:
@ -1,19 +1,27 @@
|
||||
import { useFetchUserInfo, useSelectUserInfo } from '@/hooks/userSettingHook';
|
||||
import {
|
||||
useFetchUserInfo,
|
||||
useLogout,
|
||||
useSelectUserInfo,
|
||||
} from '@/hooks/userSettingHook';
|
||||
import authorizationUtil from '@/utils/authorizationUtil';
|
||||
import type { MenuProps } from 'antd';
|
||||
import { Avatar, Button, Dropdown } from 'antd';
|
||||
import React, { useMemo } from 'react';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { history } from 'umi';
|
||||
|
||||
const App: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
const userInfo = useSelectUserInfo();
|
||||
const logout = useLogout();
|
||||
|
||||
const logout = () => {
|
||||
authorizationUtil.removeAll();
|
||||
history.push('/login');
|
||||
};
|
||||
const handleLogout = useCallback(async () => {
|
||||
const retcode = await logout();
|
||||
if (retcode === 0) {
|
||||
authorizationUtil.removeAll();
|
||||
history.push('/login');
|
||||
}
|
||||
}, [logout]);
|
||||
|
||||
const toSetting = () => {
|
||||
history.push('/setting');
|
||||
@ -23,7 +31,7 @@ const App: React.FC = () => {
|
||||
return [
|
||||
{
|
||||
key: '1',
|
||||
onClick: logout,
|
||||
onClick: handleLogout,
|
||||
label: <Button type="text">{t('header.logout')}</Button>,
|
||||
},
|
||||
{
|
||||
@ -32,7 +40,7 @@ const App: React.FC = () => {
|
||||
label: <Button type="text">{t('header.setting')}</Button>,
|
||||
},
|
||||
];
|
||||
}, [t]);
|
||||
}, [t, handleLogout]);
|
||||
|
||||
useFetchUserInfo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user