export const useGroupReducer = (state, action) => {
  switch (action.type) {
    case "CREATE_GROUP":
      return { ...state, group: action.payload };
    case "UPDATE_GROUP_NAME":
      return [...state, { name: action.payload }];
    case "DELETE_GROUP":
      return { ...state, group: null };
    default:
      return state;
  }
};

export const useDataReducer = (state, action) => {
  switch (action.type) {
    case "CREATE_CASES":
      return { ...state, cases: action.payload };
    case "UPDATE_GROUP_NAME":
      return [...state, { cases: action.payload }];
    default:
      return state;
  }
};
