Commit 59f02159 authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

clear search param in url when delete all keywords

parent 2b9b53cb
...@@ -83,9 +83,15 @@ function Navbar(props) { ...@@ -83,9 +83,15 @@ function Navbar(props) {
const isMobileMenuOpen = Boolean(mobileMoreAnchorEl); const isMobileMenuOpen = Boolean(mobileMoreAnchorEl);
function onUpdateSearch(value) { function onUpdateSearch(value) {
let query = router.query;
if (value) {
query.q = value;
} else {
delete query.q;
}
router.push({ router.push({
pathname: location.pathname, pathname: location.pathname,
query: { ...router.query, q: value }, query: { ...query },
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment