website/components/Logout.vue

42 lines
702 B
Vue
Raw Normal View History

2023-04-16 20:12:24 +03:00
<template>
<div>
<h1>Currently logged in</h1>
<Button :click="click">Logout</Button>
</div>
2023-04-16 20:12:24 +03:00
</template>
<script>
import axios from "axios"
import Button from "./Button.vue"
2023-04-16 20:12:24 +03:00
export default {
methods: {
async click(e) {
await axios.get(`/api/auth/logout?token=${localStorage.getItem("token")}`)
localStorage.clear()
location.reload()
}
}
2023-04-16 20:12:24 +03:00
}
</script>
<style scoped>
h1 {
color: var(--white);
font-size: 50px;
margin-bottom: 20px;
text-align: center;
2023-04-16 20:12:24 +03:00
}
div {
background-color: var(--dark-three);
padding: 50px;
margin-top: 50px;
display: flex;
flex-direction: column;
gap: 20px;
align-items: center;
justify-content: center;
2023-04-16 20:12:24 +03:00
}
2023-06-11 20:19:35 +03:00
</style>