diff --git a/src/aquarius/Aquarius.ts b/src/aquarius/Aquarius.ts index 9181b44..26ff1e6 100644 --- a/src/aquarius/Aquarius.ts +++ b/src/aquarius/Aquarius.ts @@ -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