Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Mar 18, 2023
1 parent 865381d commit 157905d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pages/index.tsx
Expand Up @@ -14,7 +14,9 @@ import styles from './index.module.css'

const sourceCodePro = Source_Code_Pro({ subsets: ['latin'] })

export default function HomePage(discordInfo: { discordInfo: { members: string; currentlyOnline: string } }) {
export default function HomePage(discordInfo: {
discordInfo: { members: string; currentlyOnline: string }
}) {
const [hasMounted, setHasMounted] = React.useState(false)
React.useEffect(() => {
setHasMounted(true)
Expand Down Expand Up @@ -49,7 +51,8 @@ export default function HomePage(discordInfo: { discordInfo: { members: string;
Join the Discord
</Button>
<p className={styles.discordInfo}>
Discord Members: {discordInfo.discordInfo.members}<br />
Discord Members: {discordInfo.discordInfo.members}
<br />
Currently Online: {discordInfo.discordInfo.currentlyOnline}
</p>
</div>
Expand All @@ -61,16 +64,18 @@ export default function HomePage(discordInfo: { discordInfo: { members: string;
}

export async function getStaticProps() {
const res = await fetch('https://discord.com/api/v9/invites/5A896vcp?with_counts=true&with_expiration=true')
const res = await fetch(
'https://discord.com/api/v9/invites/5A896vcp?with_counts=true&with_expiration=true'
)
const response = await res.json()
const members = response.approximate_member_count;
const members = response.approximate_member_count
const discordInfo = {
members: response.approximate_member_count,
currentlyOnline: response.approximate_presence_count
}
return {
props: {
discordInfo
},
}
}
}
}

1 comment on commit 157905d

@vercel
Copy link

@vercel vercel bot commented on 157905d Mar 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.