From 9e907dad0bccd948380ae65406726b28445c2e22 Mon Sep 17 00:00:00 2001 From: Lisa Date: Sun, 20 Dec 2020 10:48:56 +0000 Subject: [PATCH] Fix error occurring when navigating back from settings section --- slices/navigation.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/slices/navigation.js b/slices/navigation.js index 306a107..babdb03 100644 --- a/slices/navigation.js +++ b/slices/navigation.js @@ -7,23 +7,15 @@ const navigationSlice = createSlice({ currentPage: 'Home', }, reducers: { - navigate: (state, action) => { + navigate: (_state, action) => { return { currentPage: action.payload, - previousPage: state.currentPage, } }, - goBack: ({ currentPage, previousPage }) => { - if (currentPage === 'CycleDay' && !!previousPage) { - return { - currentPage: previousPage, - } - } - + goBack: ({ currentPage }) => { const page = pages.find((p) => p.component === currentPage) return { currentPage: page.parent, - previousPage: currentPage, } }, },