aboutsummaryrefslogtreecommitdiff
path: root/modern/src/store/groups.js
blob: 607b8609cfacd3a16a875f11f50f442d36d2e774 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { createSlice } from '@reduxjs/toolkit';

const { reducer, actions } = createSlice({
  name: 'groups',
  initialState: {
    items: {},
  },
  reducers: {
    refresh(state, action) {
      state.items = {};
      action.payload.forEach((item) => state.items[item.id] = item);
    },
  },
});

export { actions as groupsActions };
export { reducer as groupsReducer };