+
+
+ Welcome back {{ $store.state.auth.name }}!
+
-
+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;
+ }
+ }
+ }
+}
+