actions.js
1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import * as types from './mutations_types';
/*var actions = {};
var mts = Object.keys(types);
for (var i = 0; i < mts.length; i++) {
var fun_name = mts[i].toLocaleLowerCase(),
cmt_name = mts[i];
// console.log(fun_name, cmt_name);
actions[fun_name] = (function() {
return function({
commit
}, arg) {
console.log(types[cmt_name]);
commit(types[cmt_name], arg);
commit(types.UPDATE_LOCAL);
}
})();
}
console.log(actions);
module.exports = actions;*/
module.exports = {
clear_local: ({
commit
}) => {
commit(types.CLEAR_LOCAL);
},
update_local: ({
commit
}) => {
commit(types.UPDATE_LOCAL);
},
update_cur_shop_status: ({
commit
}, obj) => {
commit(types.UPDATE_CUR_SHOP_STATUS, obj);
},
delete_db: ({
commit
}) => {
commit(types.DELETE_DB);
commit(types.UPDATE_LOCAL);
},
create_db: ({
commit
}, {
shop
}) => {
commit(types.CREATE_DB, shop);
commit(types.UPDATE_LOCAL);
},
add_db: ({
commit
}) => {
commit(types.ADD_DB);
commit(types.UPDATE_LOCAL);
},
reduce_db: ({
commit
}) => {
commit(types.REDUCE_DB);
commit(types.UPDATE_LOCAL);
},
check_db: ({
commit
}, obj) => {
commit(types.CHECK_DB, obj);
}
};