forked from jeffbski/redux-logic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactions.js
More file actions
35 lines (30 loc) · 837 Bytes
/
actions.js
File metadata and controls
35 lines (30 loc) · 837 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
// 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 = 'search';
// action type constants
export const SEARCH = 'SEARCH';
export const SEARCH_FULFILLED = 'SEARCH_FULFILLED';
export const SEARCH_REJECTED = 'SEARCH_REJECTED';
export const actionTypes = {
SEARCH,
SEARCH_FULFILLED,
SEARCH_REJECTED
};
// action creators
export const search = ev => ({ type: SEARCH, payload: ev.target.value });
export const searchFulfilled = (users) => ({
type: SEARCH_FULFILLED,
payload: users
});
export const searchRejected = (err) => ({
type: SEARCH_REJECTED,
payload: err,
error: true
});
export const actions = {
search,
searchFulfilled,
searchRejected
};