Passing logged-in user credentials from twig to vue.
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
LOGIN_SUCCESS,
|
||||
LOGIN_ERROR,
|
||||
STORE_USER_INFO,
|
||||
LOGIN_STOP,
|
||||
} from '../mutation-types.js'
|
||||
|
||||
export default {
|
||||
@@ -11,7 +12,7 @@ export default {
|
||||
state: {
|
||||
isLoading: false,
|
||||
error: null,
|
||||
user: null,
|
||||
user: window.user,
|
||||
userUri: null,
|
||||
},
|
||||
getters: {
|
||||
@@ -36,6 +37,9 @@ export default {
|
||||
state.error = null;
|
||||
state.userUri = userUri;
|
||||
},
|
||||
[LOGIN_STOP](state, userUri) {
|
||||
state.isLoading = false;
|
||||
},
|
||||
[STORE_USER_INFO](state, user) {
|
||||
state.isLoading = false;
|
||||
state.error = null;
|
||||
@@ -60,8 +64,6 @@ export default {
|
||||
dispatch('getUserInfo', response.headers.location)
|
||||
commit(LOGIN_SUCCESS, response.headers.location);
|
||||
//this.$emit('user-authenticated', userUri);
|
||||
//this.email = '';
|
||||
//this.password = '';
|
||||
}).catch(error => {
|
||||
if (error.response.data.error) {
|
||||
|
||||
@@ -70,7 +72,7 @@ export default {
|
||||
}
|
||||
|
||||
}).finally(() => {
|
||||
// this.isLoading = false;
|
||||
commit(LOGIN_STOP);
|
||||
})
|
||||
},
|
||||
async getUserInfo({commit}, userUri) {
|
||||
|
||||
@@ -13,5 +13,6 @@ export const
|
||||
LOGIN_START = "LOGIN_START",
|
||||
LOGIN_SUCCESS = "LOGIN_SUCCESS",
|
||||
LOGIN_ERROR = "LOGIN_ERROR",
|
||||
LOGIN_STOP = "LOGIN_STOP",
|
||||
STORE_USER_INFO = "STORE_USER_INFO"
|
||||
;
|
||||
Reference in New Issue
Block a user