diff --git a/client/src/fridge/FridgeLocal.tsx b/client/src/fridge/FridgeLocal.tsx index 28aefc4..dec164c 100644 --- a/client/src/fridge/FridgeLocal.tsx +++ b/client/src/fridge/FridgeLocal.tsx @@ -24,13 +24,15 @@ export interface FridgeLocalProps { } export class FridgeLocal extends React.Component, FridgeLocalState> { - public state: FridgeLocalState = { - fridge: { - ingredients: { - edges: [] + public state: FridgeLocalState = (window && window.localStorage && window.localStorage.getItem('localFridge')) + ? JSON.parse(window.localStorage.getItem('localFridge')!) + : { + fridge: { + ingredients: { + edges: [] + } } } - } public get edges(): FridgeContentViewer_viewer_fridge_ingredients_edges[] { return this.state.fridge.ingredients.edges; @@ -76,7 +78,12 @@ export class FridgeLocal extends React.Component