client: fix logging out with new cookie auth
This commit is contained in:
parent
3f8511e0c1
commit
c57e0d6692
2 changed files with 4 additions and 2 deletions
|
@ -80,7 +80,6 @@ const Post = () => {
|
||||||
else setDocs([...docs, ...files])
|
else setDocs([...docs, ...files])
|
||||||
}, [docs, title])
|
}, [docs, title])
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Title title={title} setTitle={setTitle} />
|
<Title title={title} setTitle={setTitle} />
|
||||||
|
|
|
@ -6,7 +6,10 @@ import Cookies from 'js-cookie'
|
||||||
const useSignedIn = ({ redirectIfNotAuthed = false }: { redirectIfNotAuthed?: boolean }) => {
|
const useSignedIn = ({ redirectIfNotAuthed = false }: { redirectIfNotAuthed?: boolean }) => {
|
||||||
const [isSignedIn, setSignedIn] = useSharedState('isSignedIn', false)
|
const [isSignedIn, setSignedIn] = useSharedState('isSignedIn', false)
|
||||||
const [isLoading, setLoading] = useSharedState('isLoading', true)
|
const [isLoading, setLoading] = useSharedState('isLoading', true)
|
||||||
const signout = useCallback(() => setSignedIn(false), [setSignedIn])
|
const signout = useCallback(() => {
|
||||||
|
Cookies.remove('drift-token')
|
||||||
|
setSignedIn(false)
|
||||||
|
}, [setSignedIn])
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
if (redirectIfNotAuthed && !isLoading && isSignedIn === false) {
|
if (redirectIfNotAuthed && !isLoading && isSignedIn === false) {
|
||||||
|
|
Loading…
Reference in a new issue