Skip to content

Commit

Permalink
fix: do not error when issuer favicon not available
Browse files Browse the repository at this point in the history
  • Loading branch information
lem-onade committed Jan 25, 2024
1 parent 624dc4c commit df63cf1
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/solid-crs-core/lib/solid/solid-sdk.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,23 @@ export class SolidSDKService implements SolidService {
description = description.charAt(0).toUpperCase() + description.slice(1);

const favicon = iss.endsWith('/') ? `${iss}favicon.ico` : `${iss}/favicon.ico`;
const defaultIcon = 'https://www.donkey.bike/wp-content/uploads/2020/12/user-member-avatar-face-profile-icon-vector-22965342-300x300.jpg';

return fetch(favicon).then((response) => {
try {

const icon = response.status === 200 ? favicon : 'https://www.donkey.bike/wp-content/uploads/2020/12/user-member-avatar-face-profile-icon-vector-22965342-300x300.jpg';
return fetch(favicon).then((response) => {

return { uri: iss, icon, description };
if (response.status === 200) return { uri: iss, icon: favicon, description };

});
return { uri: iss, icon: defaultIcon, description };

});

} catch {

return { uri: iss, icon: defaultIcon, description };

}

}));

Expand Down

0 comments on commit df63cf1

Please sign in to comment.