import Vue from 'vue'
import Vuex from 'vuex'
import router from "@/router";
Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        currentPathName: ''
    },
    mutations: {
        setPath (state) {
            state.currentPathName = localStorage.getItem("currentPathName")
        },
        logout(state){
            //清空当前的缓存
            localStorage.removeItem("user");
            localStorage.removeItem("menus");
            router.push("/login")


            // 重置路由
            resetRouter()
        }
    }
})

export default store