Fix error occurring when navigating back from settings section
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { createSlice } from 'redux-starter-kit'
|
import { createSlice } from 'redux-starter-kit'
|
||||||
import { pages, isSymptomView } from '../components/pages'
|
import { pages } from '../components/pages'
|
||||||
|
|
||||||
const navigationSlice = createSlice({
|
const navigationSlice = createSlice({
|
||||||
slice: 'navigation',
|
slice: 'navigation',
|
||||||
@@ -14,22 +14,19 @@ const navigationSlice = createSlice({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
goBack: ({ currentPage, previousPage }) => {
|
goBack: ({ currentPage, previousPage }) => {
|
||||||
|
if (currentPage === 'CycleDay' && !!previousPage) {
|
||||||
if (currentPage === 'CycleDay' || isSymptomView(currentPage)) {
|
|
||||||
if (previousPage) {
|
|
||||||
return {
|
return {
|
||||||
currentPage: previousPage
|
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,
|
previousPage: currentPage,
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// Extract the action creators object and the reducer
|
// Extract the action creators object and the reducer
|
||||||
|
|||||||
Reference in New Issue
Block a user