import { getProfile } from '@api/user' import Logo from '@assets/images/logo.svg' import { useSiteContext } from '@context/SiteContext' import useAuth from '@hooks/useAuth' import useToast from '@hooks/useToast' import { A } from '@solidjs/router' import { IconLogout, IconMenuDeep, IconUserCircle } from '@tabler/icons-solidjs' import { Helpers } from '@utils/helper' import { Show, onMount } from 'solid-js' export default function Header() { const { store, setAuth, setUser } = useSiteContext() const { clickLogOut } = useAuth(setAuth) const notify = useToast() onMount(async () => { try { const resp = await getProfile() if (resp.status === 200) { setUser(resp.data) } } catch (error) { notify.error({ title: 'Get profile fail!', closable: false, description: error?.data || 'Can not get user profile!', }) } }) const logOut = async () => { try { await clickLogOut() } catch (error) { notify.error({ title: 'Logout fail!', closable: false, }) } } return ( ) }