Skip to content

Commit

Permalink
Never throw an alert when trying to display the profile picture
Browse files Browse the repository at this point in the history
  • Loading branch information
lucsoft committed Mar 1, 2024
1 parent 8e02c27 commit 3db39d1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pages/_legacy/helper.ts
Expand Up @@ -264,7 +264,17 @@ export function getNameInital(name: string) {
export function showProfilePicture(x: ProfileData) {
return ProfilePicture(
x.profile.avatar ? Image({
type: "direct", source: async () => await API.user.picture(x._id).then(stupidErrorAlert)
type: "direct", source: async () => {
const blob = new Blob();

const data = await API.user.picture(x._id);

if (data.status == "fulfilled") {
return data.value;
}

return blob;
}
}, "Profile Picture") : Label(getNameInital(x.profile.username)),
x.profile.username
);
Expand Down

0 comments on commit 3db39d1

Please sign in to comment.