blob: 5a2a90350a3e077f9782ebf6e04ce7d0fbdc630d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<template>
<div class="home">
Hi {{get_username}}!
<input type="button" value="Logout!" @click="logout">
</div>
</template>
<script>
export default {
methods: {
logout() {
this.$store.dispatch('logout')
this.$router.push('/login')
}
},
computed: {
get_username() {
return this.$store.getters['get_user'].username
}
},
created() {
if(!this.$store.getters['is_logged_in']) {
this.$router.push('/login')
}
}
}
</script>
|