| | |
| | | import React, { useCallback } from 'react'; |
| | | import { flushSync } from 'react-dom'; |
| | | import HeaderDropdown from '../HeaderDropdown'; |
| | | import { setRemoteMenu } from '@/services/route' |
| | | import { removeToken } from '@/utils/token-util' |
| | | |
| | | export type GlobalHeaderRightProps = { |
| | | menu?: boolean; |
| | |
| | | * 退出登录,并且将当前的 url 保存 |
| | | */ |
| | | const loginOut = async () => { |
| | | await outLogin(); |
| | | // await outLogin(); |
| | | removeToken(); |
| | | setRemoteMenu(null); |
| | | const { search, pathname } = window.location; |
| | | const urlParams = new URL(window.location.href).searchParams; |
| | | /** 此方法会跳转到 redirect 参数所在的位置 */ |
| | |
| | | const menuItems = [ |
| | | ...(menu |
| | | ? [ |
| | | { |
| | | key: 'center', |
| | | icon: <UserOutlined />, |
| | | label: '个人中心', |
| | | }, |
| | | { |
| | | key: 'settings', |
| | | icon: <SettingOutlined />, |
| | | label: '个人设置', |
| | | }, |
| | | { |
| | | type: 'divider' as const, |
| | | }, |
| | | ] |
| | | { |
| | | key: 'center', |
| | | icon: <UserOutlined />, |
| | | label: '个人中心', |
| | | }, |
| | | { |
| | | key: 'settings', |
| | | icon: <SettingOutlined />, |
| | | label: '个人设置', |
| | | }, |
| | | { |
| | | type: 'divider' as const, |
| | | }, |
| | | ] |
| | | : []), |
| | | { |
| | | key: 'logout', |