mirror of
https://github.com/status-im/liquid-funding.git
synced 2025-01-12 20:44:43 +00:00
fix(hooks): fix parsing a manifest that doesn't exist
This commit is contained in:
parent
8c4413c644
commit
3fd72ff15f
@ -82,7 +82,20 @@ export function useProfileData(profiles) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getProjectManifest = assets => {
|
const getProjectManifest = assets => {
|
||||||
return assets ? JSON.parse(assets.find(a => a.name.toLowerCase() === 'manifest.json').content) : null
|
if (!assets) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const manifest = assets.find(a => a.name.toLowerCase() === 'manifest.json');
|
||||||
|
if (!manifest) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return JSON.parse(manifest.content)
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Wtf', manifest);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useProjectData(projectId, profile, projectAddedEvents) {
|
export function useProjectData(projectId, profile, projectAddedEvents) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user