diff options
Diffstat (limited to 'modern/src/store/events.js')
-rw-r--r-- | modern/src/store/events.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/modern/src/store/events.js b/modern/src/store/events.js new file mode 100644 index 00000000..d4f313c0 --- /dev/null +++ b/modern/src/store/events.js @@ -0,0 +1,22 @@ +import { createSlice } from '@reduxjs/toolkit'; + +const { reducer, actions } = createSlice({ + name: 'events', + initialState: { + items: [], + }, + reducers: { + add(state, action) { + state.items.unshift(...action.payload); + }, + delete(state, action) { + state.items = state.items.filter((item) => item.id !== action.payload.id); + }, + deleteAll(state) { + state.items = []; + }, + }, +}); + +export { actions as eventsActions }; +export { reducer as eventsReducer }; |