Skip to content

Commit

Permalink
logout flow error fixed #144
Browse files Browse the repository at this point in the history
  • Loading branch information
codypharm committed Nov 13, 2023
1 parent 3ea1955 commit 78a5522
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/app/dashboard/dashLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Image from 'next/image'
import React, { useState } from 'react'
// import { useRouter } from '';
import { redirect, usePathname } from 'next/navigation'
import { usePathname } from 'next/navigation'
import imageDecenterLogoWhite from '@public/Logo White.png'
import imageDecenterLogoSubtitle from '@public/Logo Texts.png'
import { RxDashboard } from 'react-icons/rx'
Expand All @@ -24,7 +24,7 @@ import { useRouter } from 'next/navigation'
export const DashLayout = ({ children }: { children: React.ReactNode }) => {
const { user } = useUserStore()
const pathname = usePathname()

const { push, replace } = useRouter()
const [isNotificationOpen, setNotificationOpen] = useState(false)
const [showBackdrop, setShowBackdrop] = useState(false)
const [isProfileOpen, setProfileOpen] = useState(false)
Expand All @@ -46,7 +46,7 @@ export const DashLayout = ({ children }: { children: React.ReactNode }) => {
console.log('logout')
localStorage.clear()
userStore.clearUser()
redirect('/explore')
replace('/explore')
// push('/explore')
}

Expand Down Expand Up @@ -84,9 +84,8 @@ export const DashLayout = ({ children }: { children: React.ReactNode }) => {
<div className="w-full h-[90%] overflow-y-auto font-archivo ">
<Link href="/dashboard">
<div
className={`flex flex-col items-center cursor-pointer justify-center gap-3 w-full py-4 hover:bg-primary_11 text-primary_8 hover:text-primary_1 ${
pathname === '/dashboard' ? 'bg-primary_11 text-white' : ''
}`}
className={`flex flex-col items-center cursor-pointer justify-center gap-3 w-full py-4 hover:bg-primary_11 text-primary_8 hover:text-primary_1 ${pathname === '/dashboard' ? 'bg-primary_11 text-white' : ''
}`}
>
<div className="flex justify-center ">
<RxDashboard size={25} />
Expand All @@ -96,9 +95,8 @@ export const DashLayout = ({ children }: { children: React.ReactNode }) => {
</Link>
<Link href="/dashboard/train">
<div
className={`flex flex-col items-center cursor-pointer justify-center gap-3 w-full py-4 hover:bg-primary_11 text-primary_8 hover:text-primary_1 ${
pathname === '/dashboard/train' ? 'bg-primary_11 text-white' : ''
}`}
className={`flex flex-col items-center cursor-pointer justify-center gap-3 w-full py-4 hover:bg-primary_11 text-primary_8 hover:text-primary_1 ${pathname === '/dashboard/train' ? 'bg-primary_11 text-white' : ''
}`}
>
<div className="flex justify-center ">
<HiOutlineChip size={25} />
Expand All @@ -108,9 +106,8 @@ export const DashLayout = ({ children }: { children: React.ReactNode }) => {
</Link>
<Link href="/dashboard/repository">
<div
className={`flex flex-col items-center cursor-pointer justify-center gap-3 w-full py-4 hover:bg-primary_11 text-primary_8 hover:text-primary_1 ${
pathname === '/dashboard/repository' ? 'bg-primary_11 text-white' : ''
}`}
className={`flex flex-col items-center cursor-pointer justify-center gap-3 w-full py-4 hover:bg-primary_11 text-primary_8 hover:text-primary_1 ${pathname === '/dashboard/repository' ? 'bg-primary_11 text-white' : ''
}`}
>
<div className="flex justify-center ">
<BsDatabase size={25} />
Expand Down Expand Up @@ -138,9 +135,8 @@ export const DashLayout = ({ children }: { children: React.ReactNode }) => {
</div> */}
<Link href="/dashboard/settings">
<div
className={`flex flex-col items-center cursor-pointer justify-center gap-3 w-full py-4 hover:bg-primary_11 text-primary_8 hover:text-primary_1 ${
pathname === '/dashboard/settings' ? 'bg-primary_11 text-white' : ''
}`}
className={`flex flex-col items-center cursor-pointer justify-center gap-3 w-full py-4 hover:bg-primary_11 text-primary_8 hover:text-primary_1 ${pathname === '/dashboard/settings' ? 'bg-primary_11 text-white' : ''
}`}
>
<div className="flex justify-center ">
<BsDatabase size={25} />
Expand Down Expand Up @@ -193,7 +189,7 @@ export const DashLayout = ({ children }: { children: React.ReactNode }) => {
</div>
) : (
<div className="bg-primary_11 text-primary_1 font-semibold font-primaryArchivo py-2 px-3 cursor-pointer rounded-xl relative">
<button className="flex flex-row" onClick={redirect('/explore')}>
<button className="flex flex-row" onClick={() => replace('/explore')}>
Log In
</button>
</div>
Expand Down

0 comments on commit 78a5522

Please sign in to comment.