forked from jeffbski/redux-logic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions.js
44 lines (39 loc) · 1.22 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
40
41
42
43
44
// 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 = 'user';
// action type constants
export const USER_PROFILE_FETCH = 'USER_PROFILE_FETCH';
export const USER_PROFILE_FETCH_CANCEL = 'USER_PROFILE_FETCH_CANCEL';
export const USER_PROFILE_FETCH_FULFILLED = 'USER_PROFILE_FETCH_FULFILLED';
export const USER_PROFILE_FETCH_REJECTED = 'USER_PROFILE_FETCH_REJECTED';
export const actionTypes = {
USER_PROFILE_FETCH,
USER_PROFILE_FETCH_CANCEL,
USER_PROFILE_FETCH_FULFILLED,
USER_PROFILE_FETCH_REJECTED
};
// action creators
export const userProfileFetch = (id) => (
{
type: USER_PROFILE_FETCH,
payload: id
}
);
export const userProfileFetchCancel = () => ({ type: USER_PROFILE_FETCH_CANCEL });
export const userProfileFetchFulfilled = (users) => ({
type: USER_PROFILE_FETCH_FULFILLED,
payload: users
});
export const userProfileFetchRejected = (err) => ({
type: USER_PROFILE_FETCH_REJECTED,
payload: err,
error: true
});
export const actions = {
userProfileFetch,
userProfileFetchCancel,
userProfileFetchFulfilled,
userProfileFetchRejected
};