import React, { useState, useEffect, useCallback } from 'react'; // import { Link, withRouter } from 'react-router-dom'; import { ajax } from '@/utils'; import { Nav } from '@alifd/next'; import FoundationSymbol from '@icedesign/foundation-symbol'; import { headerMenuConfig } from '@/config/menu'; import styles from './index.module.scss'; function Header(props) { const [isLoading, setLoading] = useState(false); const [data, setData] = useState([]); const [loginInfoData, setLoginInfo] = useState(''); // const { pathname } = location; const pathname = '/fff'; useEffect(() => { fetchData(); }, []); const fetchData = useCallback(async () => { await setLoading(true); try { const loginInfo = await ajax({ api: 'getLoginInfo', method: 'get' }); await setLoading(false); if (loginInfo.success) { setLoginInfo(loginInfo.result.name); } } catch (e) {} }); const logout = useCallback(async () => { try { const responseData = await ajax({ api: 'logout', method: 'post' }); if (responseData.success) { location.href = '/portal/'; // await setData(responseData.result); } else { // fail } } catch (e) {} }); return (
); } export default Header;