This repository has been archived on 2024-04-29. You can view files and clone it, but cannot push or open issues or pull requests.
node-fftcg/frontend/src/views/About.vue

58 lines
1.1 KiB
Vue

<template>
<v-container>
<v-flex mb-4>
<h1 class="display-2 font-weight-bold mb-3">Hello World!</h1>
<p class="subheading font-weight-regular">
App under development, please don't submit any valuable data!
</p>
</v-flex>
<p>user session: {{ sessionID }}</p>
<v-btn @click.native="logout">Logout</v-btn>
</v-container>
</template>
<script>
import * as Cookies from 'js-cookie'
import axios from '@/plugins/axios'
export default {
name: 'About',
data: () => ({
sessionID: ''
}),
methods: {
goHome() {
Cookies.remove('session')
this.$router.push({ name: 'home' })
},
logout() {
axios
.post('/user/logout', {
session: Cookies.get('session')
})
.then(response => {
if (response.data.success) {
this.goHome()
}
})
}
},
mounted() {
axios
.post('/user/login', {
session: Cookies.get('session')
})
.then(response => {
if (response.data.success) {
this.sessionID = response.data.message
} else {
this.goHome()
}
})
}
}
</script>