session expiration / logout
This commit is contained in:
parent
604a82b7e8
commit
0eb488be2c
@ -7,8 +7,16 @@
|
|||||||
const signedIn = computed(() => Boolean(auth.token))
|
const signedIn = computed(() => Boolean(auth.token))
|
||||||
|
|
||||||
async function signOut () {
|
async function signOut () {
|
||||||
clearSession()
|
const token = auth.token
|
||||||
await router.push('/')
|
try {
|
||||||
|
await fetch('/api/signout', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
|
})
|
||||||
|
} finally {
|
||||||
|
clearSession()
|
||||||
|
await router.push('/')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user