Redux store for recent items. BOD-178

This commit is contained in:
Patrick Fic
2020-06-26 08:10:00 -07:00
parent ea77478b02
commit 82ee83c43b
6 changed files with 45 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ import ApplicationActionTypes from "./application.types";
const INITIAL_STATE = {
loading: false,
breadcrumbs: [],
recentItems: [],
scheduleLoad: {
load: {},
calculating: false,
@@ -12,6 +13,11 @@ const INITIAL_STATE = {
const applicationReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case ApplicationActionTypes.ADD_RECENT_ITEM:
return {
...state,
recentItems: [action.payload, ...state.scheduleLoad.slice(0, 9)],
};
case ApplicationActionTypes.SET_BREAD_CRUMBS:
return {
...state,