This commit is contained in:
2020-04-25 23:17:25 +02:00
parent 86ec7f4de8
commit 9d1d1b3afb
5 changed files with 60 additions and 27 deletions
+19 -5
View File
@@ -3,10 +3,13 @@
<v-app-bar fixed app color="primary" dark>
<v-btn to="/" text rounded>Simple Notes</v-btn>
<v-spacer />
<v-btn to="/notes" class="mr-2" text rounded>My notes</v-btn>
<v-btn v-if="this.$store.state.auth.loggedIn" outlined>
Welcome {{ this.$store.state.auth.user.username }}
</v-btn>
<div v-if="isAuthenticated">
<v-btn to="/notes" class="mr-2" text rounded>My notes</v-btn>
<v-btn class="mr-2" outlined>
Welcome {{ loggedInUser.username }}
</v-btn>
<v-btn outlined @click="logout">Logout</v-btn>
</div>
<v-btn v-else to="/account" text rounded>Account</v-btn>
</v-app-bar>
<v-content>
@@ -18,7 +21,18 @@
</template>
<script>
export default {}
import { mapGetters } from 'vuex'
export default {
computed: {
...mapGetters(['isAuthenticated', 'loggedInUser']),
},
methods: {
async logout() {
await this.$auth.logout()
},
},
}
</script>
<style>