react-floating-profile
Version:
React component to display your github profile <p align="left"> <a href="https://www.npmjs.com/package/react-floating-profile"><img src="https://flat.badgen.net/npm/v/react-floating-profile" alt="react-floating-profile version" /></a> <a href="http
21 lines (17 loc) • 640 B
text/typescript
import { OrgItem } from "@types";
export default async function getOrganizations(organizations_url: string, accessToken: string): Promise<OrgItem[]> {
const response = await fetch(organizations_url, {
method: "GET",
headers: {
...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}),
Accept: "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28",
"Content-Type": "application/json",
},
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(`GitHub API Error: ${errorData.message}`);
}
return response.json();
}