feat: search api remove cache header when result is empty
This commit is contained in:
@@ -57,6 +57,11 @@ export async function GET(request: Request) {
|
||||
}
|
||||
const cacheTime = await getCacheTime();
|
||||
|
||||
if (flattenedResults.length === 0) {
|
||||
// no cache if empty
|
||||
return NextResponse.json({ results: [] }, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{ results: flattenedResults },
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user