Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions packages/app/src/systems/Asset/services/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,21 @@ export class AssetService {
}

static async setListedAssets() {
const verifiedAssets = (await (
await fetch('https://verified-assets.fuel.network/assets.json')
).json()) as Array<AssetData>;
const assetsPromises = verifiedAssets.map((asset) => {
return AssetService.upsertAsset({
data: {
...asset,
isCustom: false,
},
try {
const verifiedAssets = (await (
await fetch('https://verified-assets.fuel.network/assets.json')
).json()) as Array<AssetData>;
const assetsPromises = verifiedAssets.map((asset) => {
return AssetService.upsertAsset({
data: {
...asset,
isCustom: false,
},
});
});
});

await Promise.all(assetsPromises);
await Promise.all(assetsPromises);
} catch (_) {}
}

static async updateAsset(input: AssetInputs['updateAsset']) {
Expand Down
14 changes: 10 additions & 4 deletions packages/app/src/systems/Core/utils/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ export const graphqlRequest = async <R, T = Record<string, unknown>>(
});

if (res.ok) {
const response = await res.json();
return response.data as R;
try {
const response = await res.json();
return response.data as R;
} catch (_) {}
}

const error = await res.json();
return Promise.reject(error);
try {
const error = await res.json();
return Promise.reject(error);
} catch (_) {
return Promise.reject(_);
}
};
Loading