mirror of
https://github.com/pinry/pinry.git
synced 2025-11-16 01:45:51 +01:00
Feature: Add login-form with error-handling
This commit is contained in:
committed by
Isaac Bythewood
parent
58a0b663aa
commit
5d86ef1e1d
@@ -66,6 +66,7 @@
|
||||
</a>
|
||||
<a
|
||||
v-show="!user.loggedIn"
|
||||
v-on:click="logIn"
|
||||
class="button is-light">
|
||||
Log in
|
||||
</a>
|
||||
@@ -86,6 +87,7 @@
|
||||
|
||||
<script>
|
||||
import api from './api';
|
||||
import LoginForm from './LoginForm.vue';
|
||||
|
||||
export default {
|
||||
name: 'p-header',
|
||||
@@ -102,6 +104,9 @@ export default {
|
||||
toggleMenu() {
|
||||
this.active = !this.active;
|
||||
},
|
||||
onLoginSucceed() {
|
||||
this.initializeUser();
|
||||
},
|
||||
logOut() {
|
||||
api.User.logOut().then(
|
||||
() => {
|
||||
@@ -109,6 +114,16 @@ export default {
|
||||
},
|
||||
);
|
||||
},
|
||||
logIn() {
|
||||
this.$buefy.modal.open({
|
||||
parent: this,
|
||||
component: LoginForm,
|
||||
hasModalCard: true,
|
||||
events: {
|
||||
'login.succeed': this.onLoginSucceed,
|
||||
},
|
||||
});
|
||||
},
|
||||
initializeUser() {
|
||||
const self = this;
|
||||
api.User.fetchUserInfo().then(
|
||||
|
||||
Reference in New Issue
Block a user