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) => {
setData(data)
})
setSearchTerm(router.query.q ? decodeURIComponent(router.query.q) : '')
const querySearch = router.query.q ? decodeURIComponent(router.query.q) : ''
setSearchTerm(querySearch)
router.replace(
`${router.pathname.replace('.html', '')}${e.target.value &&
'?q='}${encodeURIComponent(e.target.value)}`,
`${router.pathname.replace('.html', '')}${'?q='}${encodeURIComponent(
querySearch
)}`,
undefined,
{ shallow: true }
)