@@ -3,8 +3,10 @@ import Cookies from 'js-cookie'
3
3
const app = {
4
4
state : {
5
5
sidebar : {
6
- opened : ! + Cookies . get ( 'sidebarStatus' )
6
+ opened : ! + Cookies . get ( 'sidebarStatus' ) ,
7
+ withoutAnimation : false
7
8
} ,
9
+ device : 'desktop' ,
8
10
language : Cookies . get ( 'language' ) || 'en'
9
11
} ,
10
12
mutations : {
@@ -15,6 +17,15 @@ const app = {
15
17
Cookies . set ( 'sidebarStatus' , 0 )
16
18
}
17
19
state . sidebar . opened = ! state . sidebar . opened
20
+ state . sidebar . withoutAnimation = false
21
+ } ,
22
+ CLOSE_SIDEBAR : ( state , withoutAnimation ) => {
23
+ Cookies . set ( 'sidebarStatus' , 1 )
24
+ state . sidebar . opened = false
25
+ state . sidebar . withoutAnimation = withoutAnimation
26
+ } ,
27
+ TOGGLE_DEVICE : ( state , device ) => {
28
+ state . device = device
18
29
} ,
19
30
SET_LANGUAGE : ( state , language ) => {
20
31
state . language = language
@@ -25,6 +36,12 @@ const app = {
25
36
toggleSideBar ( { commit } ) {
26
37
commit ( 'TOGGLE_SIDEBAR' )
27
38
} ,
39
+ closeSideBar ( { commit } , { withoutAnimation } ) {
40
+ commit ( 'CLOSE_SIDEBAR' , withoutAnimation )
41
+ } ,
42
+ toggleDevice ( { commit } , device ) {
43
+ commit ( 'TOGGLE_DEVICE' , device )
44
+ } ,
28
45
setLanguage ( { commit } , language ) {
29
46
commit ( 'SET_LANGUAGE' , language )
30
47
}
0 commit comments