Fixed logout flow

This commit is contained in:
D. Scott Boggs 2023-08-26 06:54:42 -04:00
parent 5aa16762f7
commit 003383e455

View file

@ -2,11 +2,12 @@
import { RouterLink } from 'vue-router';
import { error } from '../error'
import router from "../router";
import { state } from '../state'
async function logOut() {
const result = await fetch('/api/v1/auth', {method: 'DELETE'})
if(!result.ok) return error('failed to log out')
console.debug('logged out')
state.user = undefined
router.push('/login')
}
</script>