1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| import Vue from "vue"; import Vuex from "vuex"; import SecureLS from "secure-ls"; import persistedState from "vuex-persistedstate";
const files = require.context("./modules", false, /\.js$/); let modules = {}; files.keys().forEach((key) => { let name = path.basename(key, ".js"); modules[name] = files(key).default || files(key); });
const ls = new SecureLS({ encodingType: "aes", isCompression: false, encryptionSecret: "encryption", });
export default new Vuex.Store({ state: {}, mutations: {}, actions: {}, getters: {}, modules, plugins: [ persistedState({ key: "inpackStore", paths: ["test"], storage: { getItem: (key) => ls.get(key), setItem: (key, value) => ls.set(key, value), removeItem: (key) => ls.remove(key), }, }), ], });
|