Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't check for BigInt support if user is logged in and has avatar set
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent 9347a9b commit 956c69e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/Navigation.tsx
Expand Up @@ -27,12 +27,12 @@ async function destroySession() {
function getAvatarUrl(userData: { [k: string]: any }): string {
const BASE = "https://cdn.discordapp.com/";

if (!userData.id || typeof window["BigInt"] === "undefined") return "";
if (userData.avatar)
return BASE + `avatars/${userData.id}/${userData.avatar}`;

if (!userData.avatar)
return BASE + `embed/avatars/${(BigInt(userData.id) >> 22n) % 6n}.png`;
if (!userData.id || typeof window["BigInt"] === "undefined") return "";

return BASE + `avatars/${userData.id}/${userData.avatar}`;
return BASE + `embed/avatars/${(BigInt(userData.id) >> 22n) % 6n}.png`;
}

export default function (props: {
Expand Down

0 comments on commit 956c69e

Please sign in to comment.