Fix failing dev without internet

feat/course
Kamran Ahmed 1 week ago
parent 611322bcfe
commit a91b43244a
  1. 12
      src/lib/discord.ts

@ -1,3 +1,5 @@
import { siteConfig } from './config.ts';
const formatter = Intl.NumberFormat('en-US', {
notation: 'compact',
});
@ -14,6 +16,16 @@ export async function getDiscordInfo(): Promise<{
return discordStats;
}
if (import.meta.env.DEV) {
return {
url: 'https://roadmap.sh/discord',
total: 27000,
totalFormatted: '27k',
online: 49,
onlineFormatted: '3.44k',
};
}
const response = await fetch(
'https://discord.com/api/v9/invites/cJpEt5Qbwa?with_counts=true',
);

Loading…
Cancel
Save