|
@@ -1,30 +1,37 @@
|
|
|
-import Cookies from 'js-cookie'
|
|
|
+import { getStore, setStore } from "@/utils/storage"
|
|
|
+
|
|
|
+let theme = getStore('_DEFAULT_THEME')
|
|
|
|
|
|
const app = {
|
|
|
state: {
|
|
|
sidebar: {
|
|
|
- opened: !+Cookies.get('sidebarStatus'),
|
|
|
+ opened: !+getStore('sidebarStatus'),
|
|
|
withoutAnimation: false
|
|
|
},
|
|
|
- device: 'desktop'
|
|
|
+ device: 'desktop',
|
|
|
+ theme: !theme ? 'dark' : theme
|
|
|
},
|
|
|
mutations: {
|
|
|
TOGGLE_SIDEBAR: state => {
|
|
|
if (state.sidebar.opened) {
|
|
|
- Cookies.set('sidebarStatus', 1)
|
|
|
+ setStore('sidebarStatus', 1)
|
|
|
} else {
|
|
|
- Cookies.set('sidebarStatus', 0)
|
|
|
+ setStore('sidebarStatus', 0)
|
|
|
}
|
|
|
state.sidebar.opened = !state.sidebar.opened
|
|
|
state.sidebar.withoutAnimation = false
|
|
|
},
|
|
|
CLOSE_SIDEBAR: (state, withoutAnimation) => {
|
|
|
- Cookies.set('sidebarStatus', 1)
|
|
|
+ setStore('sidebarStatus', 1)
|
|
|
state.sidebar.opened = false
|
|
|
state.sidebar.withoutAnimation = withoutAnimation
|
|
|
},
|
|
|
TOGGLE_DEVICE: (state, device) => {
|
|
|
state.device = device
|
|
|
+ },
|
|
|
+ TOGGLE_THEME: (state, theme) => {
|
|
|
+ setStore('_DEFAULT_THEME', theme)
|
|
|
+ state.theme = theme
|
|
|
}
|
|
|
},
|
|
|
actions: {
|
|
@@ -36,6 +43,9 @@ const app = {
|
|
|
},
|
|
|
ToggleDevice({ commit }, device) {
|
|
|
commit('TOGGLE_DEVICE', device)
|
|
|
+ },
|
|
|
+ ToggleTheme({ commit }, theme) {
|
|
|
+ commit('TOGGLE_THEME', theme)
|
|
|
}
|
|
|
}
|
|
|
}
|