Fix error occurring when navigating back from settings section

This commit is contained in:
Lisa
2020-12-20 10:48:56 +00:00
committed by Sofiya Tepikin
parent 08e01346f3
commit 9e907dad0b
+2 -10
View File
@@ -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,
}
},
},