19 lines
538 B
TypeScript
19 lines
538 B
TypeScript
import "server-only";
|
|
import { getRobloxFollowerConfig } from "@/lib/config/server";
|
|
|
|
export async function getRobloxFollowerCount(): Promise<number | null> {
|
|
try {
|
|
const { userId } = getRobloxFollowerConfig();
|
|
const res = await fetch(
|
|
`https://friends.roproxy.com/v1/users/${encodeURIComponent(userId)}/friends/count`,
|
|
{ cache: "no-store", signal: AbortSignal.timeout(5000) }
|
|
);
|
|
if (!res.ok) return null;
|
|
|
|
const data = await res.json();
|
|
return data.count ?? null;
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|