Last active
February 28, 2018 06:15
-
-
Save techlab23/d3fa20aeffb0c96a00f80464f79dcad5 to your computer and use it in GitHub Desktop.
App.vue to use dark theme provided by Vuetify.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<v-app id="app" dark> | |
<v-toolbar app fixed dense> | |
<v-toolbar-title> | |
Trackie<sup> pro</sup> | |
<span class="hidden-xs-only subheading"> - Your personal health tracker</span> | |
</v-toolbar-title> | |
<v-spacer></v-spacer> | |
<v-btn v-if="hasCurrentUser" value="left" @click="signOut"> | |
<span class="mr-1">{{ currentUser.displayName }}</span> | |
<v-icon>account_circle</v-icon> | |
</v-btn> | |
</v-toolbar> | |
<v-content> | |
<v-container fluid fill-height> | |
<router-view></router-view> | |
</v-container> | |
</v-content> | |
<v-footer app fixed> | |
<p class="mt-3 ml-3">Trackie<sup> pro</sup></p> | |
</v-footer> | |
</v-app> | |
</template> | |
<script> | |
import { mapGetters, mapActions } from 'vuex' | |
export default { | |
beforeCreate () { | |
// Getting the current user directly from store | |
const user = this.$store.getters.currentUser | |
if (user) { | |
this.$store.dispatch('fetchEntries') | |
} | |
}, | |
computed: { | |
...mapGetters([ | |
'currentUser', | |
'hasCurrentUser' | |
]) | |
}, | |
methods: { | |
...mapActions([ | |
'signOut' | |
]) | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment