26 lines
547 B
TypeScript
26 lines
547 B
TypeScript
import { createSlice, type PayloadAction } from "@reduxjs/toolkit";
|
|
|
|
interface StateType {
|
|
startTime: string | null;
|
|
}
|
|
|
|
const initialState: StateType = {
|
|
startTime: null,
|
|
};
|
|
|
|
const timeSlice = createSlice({
|
|
name: "time",
|
|
initialState,
|
|
reducers: {
|
|
setStartTime: (state, action: PayloadAction<string>) => {
|
|
state.startTime = action.payload;
|
|
},
|
|
clearStartTime: (state) => {
|
|
state.startTime = null;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { setStartTime, clearStartTime } = timeSlice.actions;
|
|
export default timeSlice.reducer;
|