const UserContext={
    namespaced: true,
    state:{
        userName:"",
        userId:"",
        ptyCode:"",
        menu:[],
        state:"LOGOUT",
        token:"",
    },
    mutations:{
        setLoginInfo(state,info){
            state.userName = info.userName
            state.userId = info.userId
            state.ptyCode = info.ptyCode
            state.menu = info.menu
            state.state = "LOGIN"
            state.token = info.token
            window.sessionStorage.userId = info.userId
            window.sessionStorage.userName = info.userName
            window.sessionStorage.token = info.token
        },
        setLogout(state){
            state.userName = ""
            state.userId = ""
            state.ptyCode = ""
            state.menu = []
            state.state = "LOGOUT"
            state.token = ""
        }
    }
}
export default UserContext;