forked from jeffbski/redux-logic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions.js
45 lines (39 loc) · 1.17 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
45
// 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 = 'timer';
// action type constants
export const TIMER_START = 'TIMER_START';
export const TIMER_CANCEL = 'TIMER_CANCEL';
export const TIMER_RESET = 'TIMER_RESET';
export const TIMER_END = 'TIMER_END';
export const TIMER_DECREMENT = 'TIMER_DECREMENT';
export const TIMER_START_ERROR = 'TIMER_START_ERROR';
export const actionTypes = {
TIMER_START,
TIMER_CANCEL,
TIMER_RESET,
TIMER_END,
TIMER_DECREMENT,
TIMER_START_ERROR
};
// action creators
export const timerStart = () => ({ type: TIMER_START });
export const timerCancel = () => ({ type: TIMER_CANCEL });
export const timerReset = () => ({ type: TIMER_RESET });
export const timerEnd = () => ({ type: TIMER_END });
export const timerDecrement = () => ({ type: TIMER_DECREMENT });
export const timerStartError = (err) => ({
type: TIMER_START_ERROR,
payload: err,
error: true
});
export const actions = {
timerStart,
timerCancel,
timerReset,
timerEnd,
timerDecrement,
timerStartError
};