diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-08-14 15:04:45 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-08-14 15:04:45 +0700 |
| commit | 01e86fb4a54b801a9b8124455611c312e5de4af0 (patch) | |
| tree | 09733a6f9fff4c8624bd4a2f2c514d8b16cc684b /src/core/components/elements | |
| parent | 4cfe9157d64a76bf9913fe599d908497a18f5316 (diff) | |
google sign in
Diffstat (limited to 'src/core/components/elements')
| -rw-r--r-- | src/core/components/elements/Navbar/NavbarDesktop.jsx | 5 | ||||
| -rw-r--r-- | src/core/components/elements/Navbar/NavbarUserDropdown.jsx | 8 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx index ea4b03ae..c6575831 100644 --- a/src/core/components/elements/Navbar/NavbarDesktop.jsx +++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx @@ -17,9 +17,10 @@ import { getCountCart } from '@/core/utils/cart' import TopBanner from './TopBanner' import whatsappUrl from '@/core/utils/whatsappUrl' import { useRouter } from 'next/router' -import { getAuth } from '@/core/utils/auth' +import { getAuth, setAuth } from '@/core/utils/auth' import { createSlug, getIdFromSlug } from '@/core/utils/slug' import productApi from '@/lib/product/api/productApi' +import { useSession } from 'next-auth/react' const Search = dynamic(() => import('./Search')) @@ -33,7 +34,7 @@ const NavbarDesktop = () => { const [payloadWA, setPayloadWa] = useState(null) const router = useRouter() - + useEffect(() => { const handleCartChange = () => { const cart = async () => { diff --git a/src/core/components/elements/Navbar/NavbarUserDropdown.jsx b/src/core/components/elements/Navbar/NavbarUserDropdown.jsx index 7848124c..b58be493 100644 --- a/src/core/components/elements/Navbar/NavbarUserDropdown.jsx +++ b/src/core/components/elements/Navbar/NavbarUserDropdown.jsx @@ -1,13 +1,15 @@ import { deleteAuth } from '@/core/utils/auth' import Link from '../Link/Link' import { useRouter } from 'next/router' +import { signOut, useSession } from 'next-auth/react' const NavbarUserDropdown = () => { const router = useRouter() - const logout = () => { - deleteAuth() - router.push('/login') + const logout = async () => { + deleteAuth().then(() => { + router.push('/login') + }) } return ( |
