forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions.js
53 lines (45 loc) · 969 Bytes
/
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
46
47
48
49
50
51
52
53
export const actionTypes = {
FAILURE: 'FAILURE',
INCREMENT: 'INCREMENT',
DECREMENT: 'DECREMENT',
RESET: 'RESET',
LOAD_DATA: 'LOAD_DATA',
LOAD_DATA_SUCCESS: 'LOAD_DATA_SUCCESS',
START_CLOCK: 'START_CLOCK',
TICK_CLOCK: 'TICK_CLOCK',
HYDRATE: 'HYDRATE',
}
export function failure(error) {
return {
type: actionTypes.FAILURE,
error,
}
}
export function increment() {
return { type: actionTypes.INCREMENT }
}
export function decrement() {
return { type: actionTypes.DECREMENT }
}
export function reset() {
return { type: actionTypes.RESET }
}
export function loadData() {
return { type: actionTypes.LOAD_DATA }
}
export function loadDataSuccess(data) {
return {
type: actionTypes.LOAD_DATA_SUCCESS,
data,
}
}
export function startClock() {
return { type: actionTypes.START_CLOCK }
}
export function tickClock(isServer) {
return {
type: actionTypes.TICK_CLOCK,
light: !isServer,
ts: Date.now(),
}
}