Skip to content

Commit 7059759

Browse files
committed
Refactor state events to objects
1 parent 1ae2485 commit 7059759

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/hooks/useWorkoutTimer.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ export function useWorkoutTimer() {
6767
const shouldStart = status.value === Status.STOPPED;
6868
if (shouldStart) {
6969
timestamp.current = Date.now();
70-
send(statusEvents.START);
70+
send({ type: statusEvents.START });
7171
setTimeLeft(addSeconds(new Date(0), PREP_TIME_SECONDS));
7272
setRoundsLeft(rounds);
7373
} else {
74-
send(statusEvents.STOP);
74+
send({ type: statusEvents.STOP });
7575
}
7676
}, [rounds, status, send]);
7777
React.useEffect(() => {
@@ -110,15 +110,15 @@ export function useWorkoutTimer() {
110110

111111
if (shouldSwitchToWork) {
112112
beepBreakLong.play();
113-
send(statusEvents.WORK);
113+
send({ type: statusEvents.WORK });
114114
setTimeLeft(workInterval);
115115
setRoundsLeft(prevRoundsLeft => prevRoundsLeft - 1);
116116
} else if (shouldSwitchToRest) {
117-
send(statusEvents.BREAK);
117+
send({ type: statusEvents.BREAK });
118118
setTimeLeft(breakInterval);
119119
beepWorkLong.play();
120120
} else {
121-
send(statusEvents.STOP);
121+
send({ type: statusEvents.STOP });
122122
clearInterval(interval);
123123
}
124124
}

0 commit comments

Comments
 (0)