/*
 * @Author: your name
 * @Date: 2021-12-02 16:55:35
 * @LastEditTime: 2021-12-02 16:58:05
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \vue3-element-admin\src\store\modules\app\map.js
 */
import {
    TOGGLE_SLIDER,
    SET_TOKEN,
    SET_UNAME,
    SET_USER_INFO,
    SET_MENU_LIST,
    SET_DATA
} from "./type.js";
export default {
    namespaced: true,
    state: {
        token: sessionStorage.getItem("token") || "",
        uname: sessionStorage.getItem("uname") || "",
        displayMode:'',
        gardenName:sessionStorage.getItem("gardenName") || "",
    },
    mutations: {
        [SET_TOKEN](state, token) {
            state.token = token;
            sessionStorage.setItem("token", state.token);
        },
        ["djiCloudToken"](state, djiCloudToken) {
            state.djiCloudToken = djiCloudToken;
            sessionStorage.setItem("djiCloudToken", state.djiCloudToken);
        },
        [SET_UNAME](state, uname) {
            state.uname = uname;
            sessionStorage.setItem("uname", state.uname);
        },
        [SET_USER_INFO](state, userinfoStr) {
            sessionStorage.setItem("userinfo", userinfoStr);
        },
    },
    actions: {
        [TOGGLE_SLIDER]({ commit }) {
            commit(TOGGLE_SLIDER);
        },
        [SET_TOKEN]({ commit }, token) {
            commit(SET_TOKEN, token);
        },
        ["djiCloudToken"]({ commit }, djiCloudToken) {
            commit("djiCloudToken", djiCloudToken);
        },
        [SET_UNAME]({ commit }, uname) {
            commit(SET_UNAME, uname);
        },
        [SET_MENU_LIST]({ commit }, menuList) {
            commit(SET_MENU_LIST, menuList);
        }
    },
};
