-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6c5493
commit 1ab4da2
Showing
7 changed files
with
166 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { NextResponse } from "next/server"; | ||
import { fetchReport } from "@/app/downloads/github"; | ||
import { AVM2Report } from "@/app/downloads/config"; | ||
|
||
let cachedReport: AVM2Report | undefined; | ||
|
||
export async function GET() { | ||
if (cachedReport) { | ||
return NextResponse.json(cachedReport); // Return cached result | ||
} | ||
|
||
try { | ||
const report = await fetchReport(); | ||
cachedReport = report; // Cache the result | ||
return NextResponse.json(report); | ||
} catch (error) { | ||
console.error("Error fetching report:", error); | ||
return NextResponse.json( | ||
{ error: "Failed to fetch report" }, | ||
{ status: 500 }, | ||
); | ||
} | ||
} | ||
|
||
export const dynamic = "force-static"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.