forked from osdio/noder-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessageUI.js
More file actions
35 lines (32 loc) · 797 Bytes
/
Copy pathmessageUI.js
File metadata and controls
35 lines (32 loc) · 797 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
import * as types from '../constants/ActionTypes'
const initialState = {
fetchMessagesPending: false,
fetchUnreadMessageCountPending: false,
markAsReadPending: false
}
export default function (state = initialState, action) {
const { type, meta = {} } = action
const { sequence = {} } = meta
const status = sequence.type === 'start'
switch (type) {
case types.GET_MESSAGES_LIST:
return {
...state,
fetchMessagesPending: status
}
case types.MARK_AS_READ:
return {
...state,
markAsReadPending: status
}
case types.GET_UNREAD_MESSAGE_COUNT:
return {
...state,
fetchUnreadMessageCountPending: status
}
case types.LOGOUT:
return initialState
default:
return state
}
}