@@ -17,7 +17,6 @@ export const mutations = {
17
17
}
18
18
19
19
state . boardOrder = order
20
- this . $localStore . setBoardOrder ( state . boardOrder )
21
20
} ,
22
21
addBoard ( state , board ) {
23
22
if ( ! board || ! board . id || ! board . title || ! board . icon || ! board . filter ) {
@@ -27,8 +26,6 @@ export const mutations = {
27
26
28
27
state . boards . push ( board )
29
28
state . boardOrder . push ( board . id )
30
- this . $localStore . setBoard ( board )
31
- this . $localStore . setBoardOrder ( state . boardOrder )
32
29
} ,
33
30
editBoard ( state , board ) {
34
31
let index = state . boards . findIndex ( r => r . id === board . id )
@@ -38,23 +35,17 @@ export const mutations = {
38
35
}
39
36
40
37
Vue . set ( state . boards , index , board )
41
- this . $localStore . setBoard ( board )
42
38
} ,
43
39
deleteBoard ( state , boardId ) {
44
40
let index = state . boards . findIndex ( r => r . id === boardId )
45
41
state . boards . splice ( index , 1 )
46
42
47
43
index = state . boardOrder . findIndex ( bId => bId === boardId )
48
44
state . boardOrder . splice ( index , 1 )
49
-
50
- this . $localStore . removeBoard ( boardId )
51
- this . $localStore . setBoardOrder ( state . boardOrder )
52
45
} ,
53
46
clearBoards ( state ) {
54
47
state . boards = [ ]
55
48
state . boardOrder = [ ]
56
-
57
- this . $localStore . clearBoards ( )
58
49
} ,
59
50
}
60
51
@@ -80,7 +71,36 @@ export const actions = {
80
71
init ( ctx ) {
81
72
return Promise . all ( [ this . $localStore . getBoards ( ) , this . $localStore . getBoardOrder ( ) ] )
82
73
. then ( ( [ boards , order ] ) => ctx . commit ( 'loadBoards' , { boards, order} ) )
83
- }
74
+ } ,
75
+
76
+ setBoardOrder ( ctx , order ) {
77
+ ctx . commit ( 'setBoardOrder' , order )
78
+ return this . $localStore . setBoardOrder ( ctx . state . boardOrder )
79
+ } ,
80
+ addBoard ( ctx , board ) {
81
+ ctx . commit ( 'addBoard' , board )
82
+
83
+ return Promise . all ( [
84
+ this . $localStore . setBoard ( board ) ,
85
+ this . $localStore . setBoardOrder ( ctx . state . boardOrder )
86
+ ] )
87
+ } ,
88
+ editBoard ( ctx , board ) {
89
+ ctx . commit ( 'editBoard' , board )
90
+ return this . $localStore . setBoard ( board )
91
+ } ,
92
+ deleteBoard ( ctx , boardId ) {
93
+ ctx . commit ( 'deleteBoard' , boardId )
94
+
95
+ return Promise . all ( [
96
+ this . $localStore . removeBoard ( boardId ) ,
97
+ this . $localStore . setBoardOrder ( ctx . state . boardOrder )
98
+ ] )
99
+ } ,
100
+ clearBoards ( ctx ) {
101
+ ctx . commit ( 'clearBoards' )
102
+ return this . $localStore . clearBoards ( )
103
+ } ,
84
104
}
85
105
86
106
export default {
0 commit comments