fix: move sleep-timer to separate reducer

This commit is contained in:
Lei Nelissen
2024-01-28 23:52:53 +01:00
parent 0f126d40ad
commit 0f211b00b8
4 changed files with 32 additions and 18 deletions

View File

@@ -0,0 +1,23 @@
import { PayloadAction, createSlice } from '@reduxjs/toolkit';
export interface State {
date: number | null;
}
export const initialState: State = {
date: null,
};
const sleepTimer = createSlice({
name: 'sleep-timer',
initialState,
reducers: {
setTimerDate(state, action: PayloadAction<Date | null>) {
state.date = action.payload?.getTime() || null;
}
},
});
export const { setTimerDate } = sleepTimer.actions;
export default sleepTimer;