fix: need to parse search query from request
This commit is contained in:
parent
2bd0cf429c
commit
0aadf6f6f7
|
@ -3,11 +3,14 @@ import { fetchFeedData } from "@/lib/feed";
|
||||||
|
|
||||||
type Filter = "latest" | "day" | "week" | "month";
|
type Filter = "latest" | "day" | "week" | "month";
|
||||||
|
|
||||||
export async function loader({ params }: LoaderFunctionArgs) {
|
export async function loader({ request }: LoaderFunctionArgs) {
|
||||||
|
const search = new URL(request.url).searchParams;
|
||||||
let filter: Filter | null = null;
|
let filter: Filter | null = null;
|
||||||
let page = "0";
|
let page = "0";
|
||||||
if (params?.searchParams) {
|
const searchEntries = Array.from(search.entries());
|
||||||
({ filter, page = "0" } = params.searchParams as any as {
|
if (searchEntries.length) {
|
||||||
|
const searchParams = Object.fromEntries(searchEntries);
|
||||||
|
({ filter, page = "0" } = searchParams as any as {
|
||||||
filter: Filter;
|
filter: Filter;
|
||||||
page: string;
|
page: string;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue