Added clearing monitor state

This commit is contained in:
Alex Holliday committed 2024-06-24 12:00:49 -07:00
1 parent 7d7b155d45
commit 3c8de47c5f
2 files changed
+12 -2

No files matched your search

@@ -46,7 +46,14 @@ export const getMonitorsByUserId = createAsyncThunk(
const monitorsSlice = createSlice({
name: "monitors",
initialState,
reducers: {},
reducers: {
clearMonitorState: (state) => {
state.isLoading = false;
state.monitors = [];
state.success = null;
state.msg = null;
},
},
extraReducers: (builder) => {
builder
// *****************************************************
@@ -86,6 +93,6 @@ const monitorsSlice = createSlice({
},
});
export const { setMonitors } = monitorsSlice.actions;
export const { setMonitors, clearMonitorState } = monitorsSlice.actions;
export default monitorsSlice.reducer;