persistant storage for vuex, logging instead of console.log, profile support

This commit is contained in:
Tobias Kurze
2019-04-05 13:44:59 +02:00
parent 5332940a5b
commit 91edb27529
9 changed files with 213 additions and 53 deletions

View File

@@ -0,0 +1,58 @@
<!-- components/Profile.vue -->
<template>
<div>
<section class="hero is-primary">
<div class="hero-body">
<div class="container has-text-centered">
<h2 class="title">Profile</h2>
<p>{{profile.id}}</p>
<p class="subtitle error-msg">{{ errorMsg }}</p>
</div>
</div>
</section>
</div>
</template>
<script>
import { EventBus } from '@/utils'
export default {
data () {
return {
email: '',
errorMsg: '',
};
},
methods: {
authenticate () {
this.$store.dispatch('login', { email: this.email, password: this.password })
.then(() => this.$router.push('/'));
},
},
mounted () {
this.$log.debug("Profile: mounting...");
EventBus.$on('failedLoadingProfile', (msg) => {
this.errorMsg = msg;
});
this.$store.dispatch('loadProfile');
},
beforeDestroy () {
EventBus.$off('failedLoadingProfile');
},
computed: {
profile () {
return this.$store.state.profile;
},
},
}
</script>
<style lang="scss">
.error-msg {
color: red;
font-weight: bold;
}
</style>