feat: expose unstable mode in api routes

This commit is contained in:
2026-04-27 02:49:35 -04:00
parent 224e83ac4c
commit 3c38232cd5
4 changed files with 154 additions and 18 deletions

View File

@@ -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!" },