Skip to content

Commit

Permalink
make GET /api/grants/review dynamic + revalidate page(admin)
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 committed Mar 3, 2024
1 parent 30eff7d commit a4d0c40
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/nextjs/app/api/grants/review/route.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { NextResponse } from "next/server";
import { revalidatePath } from "next/cache";
import { NextRequest, NextResponse } from "next/server";
import { getAllGrantsForReview } from "~~/services/database/grants";

export async function GET() {
export async function GET(request: NextRequest) {
try {
const path = request.nextUrl.searchParams.get("path");
const grants = await getAllGrantsForReview();
if (path) revalidatePath(path);
return NextResponse.json({ data: grants });
} catch (error) {
return NextResponse.json(
Expand Down

0 comments on commit a4d0c40

Please sign in to comment.