mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: List MCP servers #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
23 lines
534 B
TypeScript
23 lines
534 B
TypeScript
import { useLogout } from '@/hooks/login-hooks';
|
|
import { Routes } from '@/routes';
|
|
import { useCallback } from 'react';
|
|
import { useNavigate } from 'umi';
|
|
|
|
export const useHandleMenuClick = () => {
|
|
const navigate = useNavigate();
|
|
const { logout } = useLogout();
|
|
|
|
const handleMenuClick = useCallback(
|
|
(key: Routes) => () => {
|
|
if (key === Routes.Logout) {
|
|
logout();
|
|
} else {
|
|
navigate(`${Routes.ProfileSetting}${key}`);
|
|
}
|
|
},
|
|
[logout, navigate],
|
|
);
|
|
|
|
return { handleMenuClick };
|
|
};
|