19 lines
396 B
Vue
19 lines
396 B
Vue
<template>
|
|
<button type="button" @click="logOut">Log out</button>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const { refresh: sessionRefresh } = useAccountSession();
|
|
|
|
async function logOut() {
|
|
try {
|
|
await $fetch.raw("/api/auth/session", {
|
|
method: "DELETE",
|
|
});
|
|
await sessionRefresh();
|
|
|
|
} catch (err: any) {
|
|
alert(`Log out failed: ${err.statusCode} ${err.statusMessage}`);
|
|
}
|
|
}
|
|
</script>
|