Files
ragflow/web/src/pages/profile-setting/sidebar/hooks.tsx
balibabu ee33bf71eb Feat: Add ProfileSetting page #3221 (#3588)
### What problem does this PR solve?

Feat: Add ProfileSetting page  #3221
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
2024-11-22 15:11:38 +08:00

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 };
};