import user from "@/core/models/user";
export default {
    namespaced: true,
    state: {
        showLoginModal: false,
        openId: "",
        token: "",
        info: {
            id: 0,
            nickname: "",
            openid: "",
            mobile: "",
            create_time: 0,
        },
    },
    getters: {},
    mutations: {
        showLoginModal(state, data) {
            state.showLoginModal = data;
        },
        openId(state, data) {
            state.openId = data;
        },
        token(state, data) {
            state.token = data;
        },
        info(state, data) {
            state.info = data;
        }
    },
    actions: {
        info(context) {
            user.info().then(info => {
                context.commit('info', info);
            });
        },
        logout(context) {
            context.commit('info', null);
        },
    }
}
