client: remove signout() function from useSignedIn
We now use the middleware-implemented /signout route
This commit is contained in:
parent
a1fef656bb
commit
52dc5e41a5
2 changed files with 3 additions and 10 deletions
|
@ -35,7 +35,7 @@ const Header = () => {
|
|||
const [expanded, setExpanded] = useState<boolean>(false)
|
||||
const [, setBodyHidden] = useBodyScroll(null, { scrollLayer: true })
|
||||
const isMobile = useMediaQuery('xs', { match: 'down' })
|
||||
const { signedIn: isSignedIn, signout } = useSignedIn()
|
||||
const { signedIn: isSignedIn } = useSignedIn()
|
||||
const userData = useUserData();
|
||||
const [pages, setPages] = useState<Tab[]>([])
|
||||
const { setTheme, resolvedTheme } = useTheme()
|
||||
|
@ -93,7 +93,6 @@ const Header = () => {
|
|||
name: 'sign out',
|
||||
icon: <SignOutIcon />,
|
||||
value: 'signout',
|
||||
// onClick: signout,
|
||||
href: '/signout'
|
||||
},
|
||||
...defaultPages
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Cookies from "js-cookie"
|
||||
import { useRouter } from "next/router"
|
||||
import { useEffect, useState } from "react"
|
||||
import { useEffect } from "react"
|
||||
import useSharedState from "./use-shared-state"
|
||||
|
||||
const useSignedIn = () => {
|
||||
|
@ -16,12 +16,6 @@ const useSignedIn = () => {
|
|||
Cookies.set("drift-token", token)
|
||||
}
|
||||
|
||||
const signout = () => {
|
||||
setSignedIn(false)
|
||||
Cookies.remove("drift-token")
|
||||
router.push("/")
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (token) {
|
||||
setSignedIn(true)
|
||||
|
@ -30,7 +24,7 @@ const useSignedIn = () => {
|
|||
}
|
||||
}, [setSignedIn, token])
|
||||
|
||||
return { signedIn, signin, token, signout }
|
||||
return { signedIn, signin, token }
|
||||
}
|
||||
|
||||
export default useSignedIn
|
||||
|
|
Loading…
Reference in a new issue