mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
* refactor: migrate eslint to v9 * chore: lint * chore: update eslint command * chore: fix lint warnings * chore: separate lint and lint:fix * chore: exclude contentlayer generated code * fix(scripts): add missing await
27 lines
719 B
TypeScript
27 lines
719 B
TypeScript
import {uniqBy} from "@heroui/shared-utils";
|
|
import fetch from "node-fetch";
|
|
|
|
import {__PROD__} from "./env";
|
|
|
|
import {mockData, Sponsor} from "@/libs/docs/sponsors";
|
|
|
|
export const getSponsors = async () => {
|
|
try {
|
|
// if (!__PROD__) {
|
|
// return mockData;
|
|
// }
|
|
const res = await fetch("https://opencollective.com/heroui/members/all.json");
|
|
const data = (await res.json()) as Sponsor[];
|
|
|
|
// filter out repeated sponsors
|
|
const sponsors = uniqBy<Sponsor>(data, "profile").filter(
|
|
(sponsor) =>
|
|
sponsor.role !== "ADMIN" && sponsor.role !== "HOST" && sponsor.name !== "EthicalAds",
|
|
);
|
|
|
|
return sponsors as Sponsor[];
|
|
} catch {
|
|
return __PROD__ ? [] : mockData;
|
|
}
|
|
};
|