You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
468 B

import { useRouter } from "next/navigation";
import { SearchType } from "@/client/typings/search/options";
const searchPathname = "/results";
export const useSearch = (): ((query: string, filter?: SearchType) => void) => {
const router = useRouter();
return (query, filter = "all") => {
const params = new URLSearchParams();
params.set("search_query", query);
params.set("filter", filter);
router.push(searchPathname + "?" + params.toString());
};
};