/
list.js
52 lines (40 loc) · 958 Bytes
/
list.js
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
import {combineReducers} from 'redux'
export function error(state = null, action) {
switch (action.type) {
case '{{{ uc }}}_LIST_ERROR':
return action.error;
case '{{{ uc }}}_LIST_RESET':
return null;
default:
return state;
}
}
export function loading(state = false, action) {
switch (action.type) {
case '{{{ uc }}}_LIST_LOADING':
return action.loading;
case '{{{ uc }}}_LIST_RESET':
return false;
default:
return state;
}
}
export function items(state = [], action) {
switch (action.type) {
case '{{{ uc }}}_LIST_SUCCESS':
return action.items;
case '{{{ uc }}}_LIST_RESET':
return [];
default:
return state;
}
}
export function view(state = [], action) {
switch (action.type) {
case '{{{ uc }}}_LIST_VIEW':
return action.items;
default:
return state;
}
}
export default combineReducers({error, loading, items, view});