-
Notifications
You must be signed in to change notification settings - Fork 189
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
Showing
5 changed files
with
37 additions
and
34 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,17 @@ | ||
import { headers } from "next/headers"; | ||
|
||
export async function getContributors() { | ||
const headersList = headers(); | ||
const host = headersList.get("host") || ""; | ||
const protocol = headersList.get("x-forwarded-proto") || "http"; | ||
const baseUrl = `${protocol}://${host}`; | ||
|
||
try { | ||
const response = await fetch(`${baseUrl}/api/contributors`); | ||
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
console.error(error); | ||
return []; | ||
} | ||
} |
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,17 @@ | ||
import { headers } from "next/headers"; | ||
|
||
export async function getStargazers() { | ||
const headersList = headers(); | ||
const host = headersList.get("host") || ""; | ||
const protocol = headersList.get("x-forwarded-proto") || "http"; | ||
const baseUrl = `${protocol}://${host}`; | ||
|
||
try { | ||
const response = await fetch(`${baseUrl}/api/stargazers`); | ||
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
console.error(error); | ||
return 0; | ||
} | ||
} |
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