Changed store from deprecated mode
This commit is contained in:
parent
dd98cecfeb
commit
2f063735d7
|
@ -1,15 +1,15 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
|
|
||||||
const state = {
|
export const state = () => ({
|
||||||
loggedIn: false,
|
loggedIn: false,
|
||||||
user: {},
|
user: {},
|
||||||
token: null,
|
token: null,
|
||||||
config: null
|
config: null
|
||||||
};
|
});
|
||||||
|
|
||||||
/* eslint-disable no-shadow */
|
/* eslint-disable no-shadow */
|
||||||
const mutations = {
|
export const mutations = {
|
||||||
loggedIn(state, payload) {
|
loggedIn(state, payload) {
|
||||||
state.loggedIn = payload;
|
state.loggedIn = payload;
|
||||||
},
|
},
|
||||||
|
@ -37,7 +37,7 @@ const mutations = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const actions = {
|
export const actions = {
|
||||||
nuxtServerInit({ commit }, { req }) {
|
nuxtServerInit({ commit }, { req }) {
|
||||||
commit('config', {
|
commit('config', {
|
||||||
version: process.env.npm_package_version,
|
version: process.env.npm_package_version,
|
||||||
|
@ -56,11 +56,3 @@ const actions = {
|
||||||
const setAuthorizationHeader = payload => {
|
const setAuthorizationHeader = payload => {
|
||||||
Vue.axios.defaults.headers.common.Authorization = payload ? `Bearer ${payload}` : '';
|
Vue.axios.defaults.headers.common.Authorization = payload ? `Bearer ${payload}` : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const store = () => new Vuex.Store({
|
|
||||||
state,
|
|
||||||
mutations,
|
|
||||||
actions
|
|
||||||
});
|
|
||||||
|
|
||||||
export default store;
|
|
||||||
|
|
Loading…
Reference in New Issue