mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Add ProfileSetting page #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
25
web/src/pages/profile-setting/sidebar/hooks.tsx
Normal file
25
web/src/pages/profile-setting/sidebar/hooks.tsx
Normal file
@ -0,0 +1,25 @@
|
||||
import {
|
||||
ProfileSettingBaseKey,
|
||||
ProfileSettingRouteKey,
|
||||
} from '@/constants/setting';
|
||||
import { useLogout } from '@/hooks/login-hooks';
|
||||
import { useCallback } from 'react';
|
||||
import { useNavigate } from 'umi';
|
||||
|
||||
export const useHandleMenuClick = () => {
|
||||
const navigate = useNavigate();
|
||||
const { logout } = useLogout();
|
||||
|
||||
const handleMenuClick = useCallback(
|
||||
(key: ProfileSettingRouteKey) => () => {
|
||||
if (key === ProfileSettingRouteKey.Logout) {
|
||||
logout();
|
||||
} else {
|
||||
navigate(`/${ProfileSettingBaseKey}/${key}`);
|
||||
}
|
||||
},
|
||||
[logout, navigate],
|
||||
);
|
||||
|
||||
return { handleMenuClick };
|
||||
};
|
||||
Reference in New Issue
Block a user