feat: expose unstable mode in api routes
This commit is contained in:
@@ -20,9 +20,15 @@ export async function facebookRoute(req: Request): Promise<Response> {
|
||||
const LOCATION = reqUrl.searchParams.get("location") || "toronto";
|
||||
const maxItemsParam = reqUrl.searchParams.get("maxItems");
|
||||
const maxItems = maxItemsParam ? parseInt(maxItemsParam, 10) : 25;
|
||||
const hideUnstableResults =
|
||||
reqUrl.searchParams.get("unstableFilter") === "true";
|
||||
|
||||
try {
|
||||
const items = await fetchFacebookItems(SEARCH_QUERY, 1, LOCATION, maxItems);
|
||||
const items = hideUnstableResults
|
||||
? await fetchFacebookItems(SEARCH_QUERY, 1, LOCATION, maxItems, {
|
||||
hideUnstableResults: true,
|
||||
})
|
||||
: await fetchFacebookItems(SEARCH_QUERY, 1, LOCATION, maxItems);
|
||||
if (!items || items.length === 0)
|
||||
return Response.json(
|
||||
{ message: "Search didn't return any results!" },
|
||||
|
||||
Reference in New Issue
Block a user