Fixed logout flow
This commit is contained in:
parent
5aa16762f7
commit
003383e455
|
@ -2,11 +2,12 @@
|
||||||
import { RouterLink } from 'vue-router';
|
import { RouterLink } from 'vue-router';
|
||||||
import { error } from '../error'
|
import { error } from '../error'
|
||||||
import router from "../router";
|
import router from "../router";
|
||||||
|
import { state } from '../state'
|
||||||
|
|
||||||
async function logOut() {
|
async function logOut() {
|
||||||
const result = await fetch('/api/v1/auth', {method: 'DELETE'})
|
const result = await fetch('/api/v1/auth', {method: 'DELETE'})
|
||||||
if(!result.ok) return error('failed to log out')
|
if(!result.ok) return error('failed to log out')
|
||||||
console.debug('logged out')
|
state.user = undefined
|
||||||
router.push('/login')
|
router.push('/login')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue