user.ts 452 B

123456789101112131415
  1. import { DashboardSearchHit, UserState } from '../../types';
  2. import { Action, ActionTypes } from '../actions/user';
  3. const initialState: UserState = {
  4. starredDashboards: [] as DashboardSearchHit[],
  5. };
  6. export const userReducer = (state: UserState = initialState, action: Action): UserState => {
  7. switch (action.type) {
  8. case ActionTypes.LoadStarredDashboards:
  9. return { ...state, starredDashboards: action.payload };
  10. }
  11. return state;
  12. };