Files
videon-frontend/src/App.vue
marcsello 02af4b667e
All checks were successful
continuous-integration/drone/push Build is passing
Added user data loader
2020-12-06 03:55:59 +01:00

42 lines
721 B
Vue

<template>
<div id="app">
<router-view/>
<md-snackbar md-position="center" :md-duration="4000" :md-active.sync="showWelcome">
<span>Welcome back {{ $store.state.auth.name }}!</span>
</md-snackbar>
</div>
</template>
<script>
import {mapState} from 'vuex';
export default {
name: "App",
data() {
return {
showWelcome: false
}
},
computed: mapState('auth', ['name']),
mounted() {
this.$store.dispatch("auth/loadUserData").catch(() => {
this.$router.push({name: "Welcome"});
})
},
watch: {
name(newValue, oldValue) {
if (oldValue === '') {
this.showWelcome = true;
}
}
}
}
</script>
<style>
#app {
height: 100vh;
}
</style>