|
@@ -1,28 +1,22 @@
|
|
|
-import { getStore, setStore } from "@/utils/storage"
|
|
|
-
|
|
|
-let theme = getStore('_DEFAULT_THEME')
|
|
|
+import Vue from 'vue'
|
|
|
+import { SIDEBAR_TYPE, DEFAULT_THEME } from "@/store/mutation-types"
|
|
|
|
|
|
const app = {
|
|
|
state: {
|
|
|
sidebar: {
|
|
|
- opened: !+getStore('sidebarStatus'),
|
|
|
+ opened: true,
|
|
|
withoutAnimation: false
|
|
|
},
|
|
|
device: 'desktop',
|
|
|
- theme: !theme ? 'dark' : theme
|
|
|
+ theme: ''
|
|
|
},
|
|
|
mutations: {
|
|
|
- TOGGLE_SIDEBAR: state => {
|
|
|
- if (state.sidebar.opened) {
|
|
|
- setStore('sidebarStatus', 1)
|
|
|
- } else {
|
|
|
- setStore('sidebarStatus', 0)
|
|
|
- }
|
|
|
- state.sidebar.opened = !state.sidebar.opened
|
|
|
- state.sidebar.withoutAnimation = false
|
|
|
+ SET_SIDEBAR_TYPE: (state, type) => {
|
|
|
+ state.sidebar.opened = type
|
|
|
+ Vue.ls.set(SIDEBAR_TYPE, type)
|
|
|
},
|
|
|
CLOSE_SIDEBAR: (state, withoutAnimation) => {
|
|
|
- setStore('sidebarStatus', 1)
|
|
|
+ Vue.ls.set(SIDEBAR_TYPE, true)
|
|
|
state.sidebar.opened = false
|
|
|
state.sidebar.withoutAnimation = withoutAnimation
|
|
|
},
|
|
@@ -30,15 +24,16 @@ const app = {
|
|
|
state.device = device
|
|
|
},
|
|
|
TOGGLE_THEME: (state, theme) => {
|
|
|
- setStore('_DEFAULT_THEME', theme)
|
|
|
+ // setStore('_DEFAULT_THEME', theme)
|
|
|
+ Vue.ls.set(DEFAULT_THEME, theme)
|
|
|
state.theme = theme
|
|
|
}
|
|
|
},
|
|
|
actions: {
|
|
|
- ToggleSideBar: ({ commit }) => {
|
|
|
- commit('TOGGLE_SIDEBAR')
|
|
|
+ setSidebar: ({ commit }, type) => {
|
|
|
+ commit('SET_SIDEBAR_TYPE', type)
|
|
|
},
|
|
|
- CloseSideBar({ commit }, { withoutAnimation }) {
|
|
|
+ CloseSidebar({ commit }, { withoutAnimation }) {
|
|
|
commit('CLOSE_SIDEBAR', withoutAnimation)
|
|
|
},
|
|
|
ToggleDevice({ commit }, device) {
|