fix: search

This commit is contained in:
Kentai Radiquum 2025-03-22 01:56:03 +05:00
parent 9c26654ca9
commit ae92a7a424
Signed by: Radiquum
GPG key ID: 858E8EE696525EED

View file

@ -49,16 +49,26 @@ export async function GET(request: NextRequest) {
if (token) { if (token) {
url.searchParams.set("token", token); url.searchParams.set("token", token);
} }
const data = { query, searchBy }; const body = { query, searchBy };
const response = await fetchDataViaPost( const { data, error } = await fetchDataViaPost(
url.toString(), url.toString(),
JSON.stringify(data), JSON.stringify(body),
true true
); );
if (!response) { if (error) {
return NextResponse.json({ message: "Bad request" }, { status: 400 }); return new Response(JSON.stringify(error), {
status: 500,
headers: {
"Content-Type": "application/json",
},
});
} }
return NextResponse.json(response); return new Response(JSON.stringify(data), {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
} }