Changed store from deprecated mode

This commit is contained in:
Pitu 2019-03-12 05:38:25 +00:00
parent dd98cecfeb
commit 2f063735d7
1 changed files with 4 additions and 12 deletions

View File

@ -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;