/**
 * @description 所有全局配置的状态管理，如无必要请勿修改
 */
import { logo, title } from '@/config';

const state = () => ({
  logo,
  title,
  device: 'desktop',
  collapse: false,
});
const getters = {
  logo: state => state.logo,
  title: state => state.title,
  device: state => state.device,
  collapse: state => state.collapse,
};
const mutations = {
  openSideBar(state) {
    state.collapse = false;
  },
  foldSideBar(state) {
    state.collapse = true;
  },
  toggleDevice(state, device) {
    state.device = device;
  },
  toggleCollapse(state) {
    state.collapse = !state.collapse;
  },
};
const actions = {
  openSideBar({ commit }) {
    commit('openSideBar');
  },
  foldSideBar({ commit }) {
    commit('foldSideBar');
  },
  toggleDevice({ commit }, device) {
    commit('toggleDevice', device);
  },
  toggleCollapse({ commit }) {
    commit('toggleCollapse');
  },
};
export default { state, getters, mutations, actions };
