Created
September 20, 2018 08:17
-
-
Save akhbar/5637abb828482c5194c08e9640492c70 to your computer and use it in GitHub Desktop.
new store
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Vue from 'vue'; | |
| import Vuex from 'vuex'; | |
| import createPersistedState from "vuex-persistedstate"; | |
| import * as Cookies from "js-cookie"; | |
| Vue.use(Vuex); | |
| export const store = new Vuex.Store({ | |
| state: { | |
| data:{} | |
| }, | |
| getters: { | |
| data:state => state.data | |
| }, | |
| actions: { | |
| setData(context, payload) { | |
| context.commit('SET_DATA', payload); | |
| }, | |
| clearData(context) { | |
| context.commit('CLEAR_DATA') | |
| } | |
| }, | |
| mutations: { | |
| SET_DATA: (state, payload) => { | |
| state.data.secureToken = payload; | |
| }, | |
| CLEAR_DATA: (state) => { | |
| state.data = {} | |
| } | |
| }, | |
| plugins: [ | |
| createPersistedState() | |
| ] | |
| }) | |
| //export default store |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment