/*
 * @Author: jixiang
 * @Date: 2021-04-07 11:06:09
 * @Description:
 * @FilePath: /pc/src/store/modules/user/mutations.ts
 * 56580223@qq.com
 */
import { LocalStorageService, SessionStorageService } from '@/utils/storage';
import { removeToken } from '@/utils/cookie';
import { setStore } from '@/utils/store';
export default {
  __set(state: any, msg: { key: string; val: any }) {
    state[msg.key] = msg.val;
  },
  DEL_STORAGE() {
    LocalStorageService.clearAll();
    SessionStorageService.clearAll();
    localStorage.clear();
    sessionStorage.clear();
    removeToken();
  },
  // 设置用户用户信息
  SET_USERINFO: (state, userInfo) => {
    state.userInfo = userInfo;
    setStore({ name: 'userInfo', content: userInfo });
  },
};
