Replacing .html

This commit is contained in:
mrfry 2020-11-07 09:17:03 +01:00
parent eec6f420b6
commit 373adb1597

View file

@ -22,10 +22,12 @@ export default function AllQuestions({ router }) {
.then((data) => { .then((data) => {
setData(data) setData(data)
}) })
setSearchTerm(router.query.q ? decodeURIComponent(router.query.q) : '') const querySearch = router.query.q ? decodeURIComponent(router.query.q) : ''
setSearchTerm(querySearch)
router.replace( router.replace(
`${router.pathname.replace('.html', '')}${e.target.value && `${router.pathname.replace('.html', '')}${'?q='}${encodeURIComponent(
'?q='}${encodeURIComponent(e.target.value)}`, querySearch
)}`,
undefined, undefined,
{ shallow: true } { shallow: true }
) )