summaryrefslogtreecommitdiff
path: root/src/core/components/elements
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/components/elements')
-rw-r--r--src/core/components/elements/Navbar/NavbarDesktop.jsx5
-rw-r--r--src/core/components/elements/Navbar/NavbarUserDropdown.jsx8
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 (