The weeb for the next gen discord boat - Wamellow wamellow.com
bot discord
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: header avatar not loading (#51)

authored by

Luna Seemann and committed by
GitHub
6447047f 40a804a5

+8 -12
-3
common/user.ts
··· 11 11 avatar: string | null; 12 12 premium?: number | null; 13 13 14 - __fetched: boolean; 15 - 16 14 extended: ApiV1UsersMeGetResponse | undefined; 17 15 } 18 16 ··· 23 21 username: "", 24 22 avatar: "null", 25 23 26 - __fetched: false, 27 24 extended: undefined 28 25 }));
+7 -8
components/header.tsx
··· 33 33 34 34 useEffect(() => { 35 35 authorize({ setState }) 36 - .then((_user) => { 37 - userStore.setState({ 38 - ...(_user || {}), 39 - __fetched: true 40 - }); 36 + .then((u) => { 37 + if (!u) return; 38 + userStore.setState(u); 41 39 }); 42 40 43 41 webStore.setState({ ··· 49 47 return <LoginButton state={state} className="ml-auto" />; 50 48 } 51 49 52 - if (state === State.Loading || !user) { 50 + if (state === State.Loading || !user?.id) { 53 51 return ( 54 52 <div className="ml-auto flex items-center py-2 px-4"> 55 - <Skeleton className="rounded-full mr-2 size-[30px]" /> 53 + <Skeleton className="rounded-full mr-2 size-7" /> 56 54 <Skeleton className="rounded-xl w-20 h-5" /> 57 55 </div> 58 56 ); ··· 69 67 className="ml-auto truncate flex hover:bg-wamellow py-2 px-4 rounded-lg duration-200 items-center data-[state=open]:bg-wamellow outline-none" 70 68 > 71 69 <UserAvatar 72 - className="size-[30px] mr-2" 70 + className="size-7 mr-2" 73 71 alt={user.username} 74 72 src={user.avatar ? `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}?size=96` : "/discord.webp"} 75 73 /> ··· 136 134 className="text-red-400" 137 135 > 138 136 <button 137 + className="w-full" 139 138 onClick={() => { 140 139 window.location.href = "/login?logout=true"; 141 140 }}
+1 -1
utils/authorize-user.ts
··· 26 26 return null; 27 27 } 28 28 29 - if (!res) { 29 + if (!res || "status" in res) { 30 30 setState(State.Failure); 31 31 return null; 32 32 }