online and offline base cart
This commit is contained in:
+15
-1
@@ -2,11 +2,25 @@
|
||||
import Input from '@/components/Input'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
import { DocumentText, Home, Profile, ShoppingCart, HambergerMenu } from 'iconsax-react'
|
||||
import { FC, Fragment, useState } from 'react'
|
||||
import { FC, Fragment, useEffect, useState } from 'react'
|
||||
import Menu from './components/Menu'
|
||||
import { useSharedStore } from './store/sharedStore'
|
||||
import { getToken } from '@/config/func'
|
||||
|
||||
const Header: FC = () => {
|
||||
|
||||
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false)
|
||||
const { setIsLogin } = useSharedStore()
|
||||
|
||||
const handleSetIsLogin = async () => {
|
||||
const token = await getToken()
|
||||
setIsLogin(token ? true : false)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleSetIsLogin()
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
|
||||
Reference in New Issue
Block a user