Merge branch 'Bug-android-back-button-when-navigating-away-from-settings' into 'rebased-redesign'

Fix error occurring when navigating back from settings section

See merge request bloodyhealth/drip!319
This commit is contained in:
Sofiya Tepikin
2020-12-20 10:48:56 +00:00
+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,
}
},
},