client: remove signout() function from useSignedIn

We now use the middleware-implemented /signout route
This commit is contained in:
Max Leiter 2022-04-02 00:46:39 -07:00
parent a1fef656bb
commit 52dc5e41a5
No known key found for this signature in database
GPG key ID: A3512F2F2F17EBDA
2 changed files with 3 additions and 10 deletions

View file

@ -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

View file

@ -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