forked from jeffbski/redux-logic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions.js
39 lines (34 loc) · 1.04 KB
/
actions.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
// unique key namespace used by combineReducers.
// By convention it will match the directory structure to
// make it easy to locate the src.
// Also action types will prefix with the capitalized version
export const key = 'users';
// action type constants
export const USERS_FETCH = 'USERS_FETCH';
export const USERS_FETCH_CANCEL = 'USERS_FETCH_CANCEL';
export const USERS_FETCH_FULFILLED = 'USERS_FETCH_FULFILLED';
export const USERS_FETCH_REJECTED = 'USERS_FETCH_REJECTED';
export const actionTypes = {
USERS_FETCH,
USERS_FETCH_CANCEL,
USERS_FETCH_FULFILLED,
USERS_FETCH_REJECTED
};
// action creators
export const usersFetch = () => ({ type: USERS_FETCH });
export const usersFetchCancel = () => ({ type: USERS_FETCH_CANCEL });
export const usersFetchFulfilled = (users) => ({
type: USERS_FETCH_FULFILLED,
payload: users
});
export const usersFetchRejected = (err) => ({
type: USERS_FETCH_REJECTED,
payload: err,
error: true
});
export const actions = {
usersFetch,
usersFetchCancel,
usersFetchFulfilled,
usersFetchRejected
};