Skip to content

Commit

Permalink
Add local image and don't crash when logo is missing. (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusdrw authored Sep 14, 2021
1 parent 05a1771 commit 3934c6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Binary file added src/assets/chainsLogos/local.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion src/util/getConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ export const getConfigs = async (apiPromise: ApiPromise): Promise<Configs> => {
const { ss58Format } = properties!;
const systemChain = await apiPromise.rpc.system.chain();
const chainName = systemChain.split(' ')[0];
const logoUrl = require(`../assets/chainsLogos/${chainName.toLowerCase()}.png`).default;

let logoUrl;
try {
logoUrl = require(`../assets/chainsLogos/${chainName.toLowerCase()}.png`).default;
} catch (e) {
logoUrl = require('../assets/chainsLogos/local.png').default;
}

return { chainName, ss58Format: parseInt(ss58Format.toString()), logoUrl };
};
Expand Down

0 comments on commit 3934c6d

Please sign in to comment.