feat: persist mscz url
This commit is contained in:
parent
0f4d032399
commit
6e895b3cc1
2 changed files with 5 additions and 3 deletions
|
@ -18,7 +18,7 @@ export const fetchMscz = async (scoreinfo: ScoreInfo, _fetch = getFetch()): Prom
|
||||||
}
|
}
|
||||||
const cidRes = await r0.json()
|
const cidRes = await r0.json()
|
||||||
|
|
||||||
const r = await _fetch(scoreinfo.getMsczUrl(cidRes))
|
const r = await _fetch(scoreinfo.loadMsczUrl(cidRes))
|
||||||
assertRes(r)
|
assertRes(r)
|
||||||
const data = await r.arrayBuffer()
|
const data = await r.arrayBuffer()
|
||||||
return data
|
return data
|
||||||
|
|
|
@ -26,7 +26,8 @@ export abstract class ScoreInfo {
|
||||||
return `https://ipfs.infura.io:5001/api/v0/block/stat?arg=${this.msczIpfsRef}`
|
return `https://ipfs.infura.io:5001/api/v0/block/stat?arg=${this.msczIpfsRef}`
|
||||||
}
|
}
|
||||||
|
|
||||||
getMsczUrl (cidRes: { Key: string; Message: string }): string {
|
public msczUrl: string;
|
||||||
|
public loadMsczUrl (cidRes: { Key: string; Message: string }): string {
|
||||||
const cid = cidRes.Key
|
const cid = cidRes.Key
|
||||||
if (!cid) {
|
if (!cid) {
|
||||||
// read further error msg
|
// read further error msg
|
||||||
|
@ -37,7 +38,8 @@ export abstract class ScoreInfo {
|
||||||
throw new Error(err)
|
throw new Error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return `https://ipfs.infura.io/ipfs/${cid}`
|
this.msczUrl = `https://ipfs.infura.io/ipfs/${cid}`
|
||||||
|
return this.msczUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue