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