forked from osdio/noder-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtopicUI.js
More file actions
50 lines (46 loc) · 858 Bytes
/
topicUI.js
File metadata and controls
50 lines (46 loc) · 858 Bytes
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
import * as types from '../constants/ActionTypes';
const initialState = {
loadPending: {},
replyPending: {},
upPending: {},
publishPending: false
};
export default function (state = initialState, action) {
const {type, meta={}} = action;
const {sequence={}} = meta;
const {id} = meta;
const status = sequence.type == 'start';
switch (type) {
case types.GET_TOPIC_BY_ID:
return {
...state,
loadPending: {
...state.loadPending,
[id]: status
}
};
case types.REPLY_TOPIC_BY_ID:
return {
...state,
replyPending: {
...state.replyPending,
[id]: status
}
};
case types.UP_REPLY:
return {
...state,
upPending: {
...state.upPending,
[id]: status
}
};
case types.PUBLISH:
return {
...state,
publishPending: status
};
default:
return state;
}
}