-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* π» add rf/rounds * π» add /rf/rounds/id route * β¨ prettier
- Loading branch information
1 parent
62948be
commit 0d9d15f
Showing
2 changed files
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { cache } from "react"; | ||
|
||
async function getRetroFundingRound(roundId: string) { | ||
const defaultEvents = [ | ||
{ | ||
status: "PLANNED", | ||
timestamp: "2024-01-01T00:00:00Z", | ||
}, | ||
{ | ||
status: "SCHEDULED", | ||
timestamp: "2024-02-01T00:00:00Z", | ||
}, | ||
{ | ||
status: "DONE", | ||
timestamp: "2024-03-01T00:00:00Z", | ||
}, | ||
]; | ||
const defaultround = { | ||
roundId: 3, | ||
name: "RetroPGF Round Three", | ||
description: "The third retroactive funding round", | ||
externalLink: "https://vote.optimism.io/retropgf/3/summary", | ||
events: defaultEvents, | ||
}; | ||
|
||
return defaultround; | ||
} | ||
|
||
export const fetchRetroFundingRounds = cache(getRetroFundingRound); |
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,13 @@ | ||
import { NextResponse, type NextRequest } from "next/server"; | ||
import { fetchRetroFundingRounds } from "@/app/api/common/rounds/getRetroFundingRounds"; | ||
|
||
export async function GET( | ||
request: NextRequest, | ||
route: { params: { roundId: string } } | ||
) { | ||
const { roundId } = route.params; | ||
const round = await fetchRetroFundingRounds(roundId); | ||
return new Response(JSON.stringify(round), { | ||
status: 200, | ||
}); | ||
} |