set location to / if cannot back

This commit is contained in:
SrGooglo 2023-05-31 01:39:51 +00:00
parent 7236235ad2
commit 3713083a94

View File

@ -176,7 +176,14 @@ export const PageRender = React.memo((props) => {
}
app.backLocation = (state = {}) => {
return navigate(app.location.lastPathname, {
let to = app.location.lastPathname
if (!to || to === app.location.pathname) {
console.warn("No last location found, redirecting to /")
to = "/"
}
return navigate(to, {
state
})
}