mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-26 00:46:52 +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)
26 lines
623 B
TypeScript
26 lines
623 B
TypeScript
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 };
|
|
};
|