瀏覽代碼

Changed store from deprecated mode

Pitu 6 年之前
父節點
當前提交
2f063735d7
共有 1 個文件被更改,包括 4 次插入12 次删除
  1. 4 12
      src/site/store/index.js

+ 4 - 12
src/site/store/index.js

@@ -1,15 +1,15 @@
 import Vue from 'vue';
 import Vuex from 'vuex';
 
-const state = {
+export const state = () => ({
 	loggedIn: false,
 	user: {},
 	token: null,
 	config: null
-};
+});
 
 /* eslint-disable no-shadow */
-const mutations = {
+export const mutations = {
 	loggedIn(state, payload) {
 		state.loggedIn = payload;
 	},
@@ -37,7 +37,7 @@ const mutations = {
 	}
 };
 
-const actions = {
+export const actions = {
 	nuxtServerInit({ commit }, { req }) {
 		commit('config', {
 			version: process.env.npm_package_version,
@@ -56,11 +56,3 @@ const actions = {
 const setAuthorizationHeader = payload => {
 	Vue.axios.defaults.headers.common.Authorization = payload ? `Bearer ${payload}` : '';
 };
-
-const store = () => new Vuex.Store({
-	state,
-	mutations,
-	actions
-});
-
-export default store;