1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

fix retrieveDDO and storeDDO

This commit is contained in:
Sebastian Gerske 2018-11-16 13:34:52 +01:00
parent 3cd9306928
commit 7a79bd3883

View File

@ -96,11 +96,14 @@ export default class Aquarius {
.post(fullUrl, DDO.serialize(ddo))
.then((response: any) => {
if (response.ok) {
return new DDO(response.json() as DDO)
return response.json()
}
Logger.error("storeDDO failed:", response.status, response.statusText)
return null as DDO
})
.then((response: DDO) => {
return new DDO(response) as DDO
})
.catch((error) => {
Logger.error("Error fetching querying metadata: ", error)
return null as DDO
@ -115,11 +118,14 @@ export default class Aquarius {
.get(fullUrl)
.then((response: any) => {
if (response.ok) {
return new DDO(response.json() as DDO)
return response.json()
}
Logger.log("retrieveDDO failed:", response.status, response.statusText)
return null as DDO
})
.then((response: DDO) => {
return new DDO(response) as DDO
})
.catch((error) => {
Logger.error("Error fetching querying metadata: ", error)
return null as DDO