fetch project info from subgraph
This commit is contained in:
parent
1ae15cdbe3
commit
47dd9320cb
|
@ -32,7 +32,6 @@ export const batchAddPledges = async (pledges, profiles = []) => {
|
|||
const batch = pledges.map(data => {
|
||||
return pledgesCollection.prepareCreate(pledge => createPledge(pledge, data, profiles))
|
||||
})
|
||||
console.log({batch})
|
||||
return await database.action(async () => await database.batch(...batch))
|
||||
}
|
||||
|
||||
|
|
|
@ -89,10 +89,23 @@ const isManifest = asset => {
|
|||
const name = asset.path.split('/').slice(-1)[0]
|
||||
return name.toLowerCase() === 'manifest.json'
|
||||
}
|
||||
const getProjectManifest = assets => {
|
||||
const getProjectManifest = (data, assets) => {
|
||||
if (data && data.profile && data.profile.projectInfo) {
|
||||
const { isPlaying, type, file } = data.profile.projectInfo
|
||||
return {
|
||||
...data.profile.projectInfo,
|
||||
media: {
|
||||
isPlaying,
|
||||
type,
|
||||
file
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!assets) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const manifest = assets.find(isManifest);
|
||||
if (!manifest) {
|
||||
return null;
|
||||
|
@ -132,7 +145,7 @@ export function useProjectData(projectId, data) {
|
|||
getProjectAssets(data, setAssets)
|
||||
}, [ipfsReady, data])
|
||||
|
||||
const manifest = useMemo(() => getProjectManifest(projectAssets), [projectAssets, projectId])
|
||||
const manifest = useMemo(() => getProjectManifest(data, projectAssets), [data, projectAssets, projectId])
|
||||
|
||||
return {
|
||||
account,
|
||||
|
|
|
@ -17,6 +17,21 @@ query Profile($id: ID!){
|
|||
lifetimeReceived
|
||||
balance
|
||||
}
|
||||
projectInfo{
|
||||
id
|
||||
title
|
||||
subtitle
|
||||
creator
|
||||
repo
|
||||
avatar
|
||||
goal
|
||||
goalToken
|
||||
description
|
||||
chatRoom
|
||||
file
|
||||
type
|
||||
isPlaying
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
|
Loading…
Reference in New Issue