vikunja-frontend/src/components/Home.vue

37 lines
761 B
Vue
Raw Normal View History

2018-09-06 19:46:38 +02:00
<template>
<div>
<h3>Hiiiii</h3>
2018-09-06 20:01:03 +02:00
<span v-if="authenticated">Logged in
<button v-on:click="logout()" class="button">Logout</button>
</span>
2018-09-06 19:46:38 +02:00
</div>
</template>
<script>
import auth from '../auth'
import router from '../router'
export default {
name: "Home",
data() {
return {
authenticated: auth.user.authenticated
}
},
beforeMount() {
// Check if the user is already logged in, if so, redirect him to the homepage
if (!auth.user.authenticated) {
router.push({name: 'login'})
}
},
2018-09-06 20:01:03 +02:00
methods: {
logout () {
auth.logout()
}
},
2018-09-06 19:46:38 +02:00
}
</script>
<style scoped>
</style>