Skip to content

Commit

Permalink
FW-6330 restore browserlike go back behaviour (#710)
Browse files Browse the repository at this point in the history
* FW-6330 don't rely on location key, restore browserlike go back behaviour

* Revert previous commit and change ErrorHandler only
  • Loading branch information
gmcauliffe authored Dec 6, 2024
1 parent bb2eeed commit b549e90
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/components/ErrorHandler/ErrorHandlerData.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import { useSearchParams } from 'react-router-dom'
import { useSearchParams, useNavigate } from 'react-router-dom'

// FPCC
import useGoBack from 'common/hooks/useGoBack'
import { useSiteStore } from 'context/SiteContext'

function ErrorHandlerData() {
const [searchParams] = useSearchParams()

const { site } = useSiteStore()
const { goBack } = useGoBack({
fallbackRoute: site?.sitename ? `/${site?.sitename}` : '/',
})
const navigate = useNavigate()
const backHandler = () => navigate(-1)

const status = searchParams.get('status') || '0'
const statusText = searchParams.get('statusText') || null

return {
errorStatusCode: parseInt(status, 10),
errorStatusText: statusText,
backHandler: goBack,
backHandler,
}
}

Expand Down

0 comments on commit b549e90

Please sign in to comment.