commit
26f684e945
@ -1,66 +1,66 @@
|
|||||||
import Cookies from 'js-cookie'
|
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
|
opened: localStorage.getItem("sidebarStatus")
|
||||||
|
? !!+localStorage.getItem("sidebarStatus")
|
||||||
|
: true,
|
||||||
withoutAnimation: false,
|
withoutAnimation: false,
|
||||||
hide: false
|
hide: false,
|
||||||
},
|
},
|
||||||
device: 'desktop',
|
device: "desktop",
|
||||||
size: Cookies.get('size') || 'medium'
|
size: localStorage.getItem("size") || "medium",
|
||||||
}
|
};
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
TOGGLE_SIDEBAR: state => {
|
TOGGLE_SIDEBAR: (state) => {
|
||||||
if (state.sidebar.hide) {
|
if (state.sidebar.hide) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
state.sidebar.opened = !state.sidebar.opened
|
state.sidebar.opened = !state.sidebar.opened;
|
||||||
state.sidebar.withoutAnimation = false
|
state.sidebar.withoutAnimation = false;
|
||||||
if (state.sidebar.opened) {
|
if (state.sidebar.opened) {
|
||||||
Cookies.set('sidebarStatus', 1)
|
localStorage.setItem("sidebarStatus", 1);
|
||||||
} else {
|
} else {
|
||||||
Cookies.set('sidebarStatus', 0)
|
localStorage.setItem("sidebarStatus", 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CLOSE_SIDEBAR: (state, withoutAnimation) => {
|
CLOSE_SIDEBAR: (state, withoutAnimation) => {
|
||||||
Cookies.set('sidebarStatus', 0)
|
localStorage.setItem("sidebarStatus", 0);
|
||||||
state.sidebar.opened = false
|
state.sidebar.opened = false;
|
||||||
state.sidebar.withoutAnimation = withoutAnimation
|
state.sidebar.withoutAnimation = withoutAnimation;
|
||||||
},
|
},
|
||||||
TOGGLE_DEVICE: (state, device) => {
|
TOGGLE_DEVICE: (state, device) => {
|
||||||
state.device = device
|
state.device = device;
|
||||||
},
|
},
|
||||||
SET_SIZE: (state, size) => {
|
SET_SIZE: (state, size) => {
|
||||||
state.size = size
|
state.size = size;
|
||||||
Cookies.set('size', size)
|
localStorage.setItem("size", size);
|
||||||
},
|
},
|
||||||
SET_SIDEBAR_HIDE: (state, status) => {
|
SET_SIDEBAR_HIDE: (state, status) => {
|
||||||
state.sidebar.hide = status
|
state.sidebar.hide = status;
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
toggleSideBar({ commit }) {
|
toggleSideBar({ commit }) {
|
||||||
commit('TOGGLE_SIDEBAR')
|
commit("TOGGLE_SIDEBAR");
|
||||||
},
|
},
|
||||||
closeSideBar({ commit }, { withoutAnimation }) {
|
closeSideBar({ commit }, { withoutAnimation }) {
|
||||||
commit('CLOSE_SIDEBAR', withoutAnimation)
|
commit("CLOSE_SIDEBAR", withoutAnimation);
|
||||||
},
|
},
|
||||||
toggleDevice({ commit }, device) {
|
toggleDevice({ commit }, device) {
|
||||||
commit('TOGGLE_DEVICE', device)
|
commit("TOGGLE_DEVICE", device);
|
||||||
},
|
},
|
||||||
setSize({ commit }, size) {
|
setSize({ commit }, size) {
|
||||||
commit('SET_SIZE', size)
|
commit("SET_SIZE", size);
|
||||||
},
|
},
|
||||||
toggleSideBarHide({ commit }, status) {
|
toggleSideBarHide({ commit }, status) {
|
||||||
commit('SET_SIDEBAR_HIDE', status)
|
commit("SET_SIDEBAR_HIDE", status);
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state,
|
state,
|
||||||
mutations,
|
mutations,
|
||||||
actions
|
actions,
|
||||||
}
|
};
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue