import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
	strict: true,
	state: {
		token: localStorage.getItem("token")
	},
	getters: {
		token: state => state.token,
	},
	mutations: {
		setToken(state, token) {
			state.token = token
		}
	},
	actions: {
		login({ commit }, token) {
			commit('setToken', token)
		},
	}
})
