Fix error occurring when navigating back from settings section
This commit is contained in:
+2
-10
@@ -7,23 +7,15 @@ const navigationSlice = createSlice({
|
|||||||
currentPage: 'Home',
|
currentPage: 'Home',
|
||||||
},
|
},
|
||||||
reducers: {
|
reducers: {
|
||||||
navigate: (state, action) => {
|
navigate: (_state, action) => {
|
||||||
return {
|
return {
|
||||||
currentPage: action.payload,
|
currentPage: action.payload,
|
||||||
previousPage: state.currentPage,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
goBack: ({ currentPage, previousPage }) => {
|
goBack: ({ currentPage }) => {
|
||||||
if (currentPage === 'CycleDay' && !!previousPage) {
|
|
||||||
return {
|
|
||||||
currentPage: previousPage,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const page = pages.find((p) => p.component === currentPage)
|
const page = pages.find((p) => p.component === currentPage)
|
||||||
return {
|
return {
|
||||||
currentPage: page.parent,
|
currentPage: page.parent,
|
||||||
previousPage: currentPage,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user