From 7a79bd3883b8c915a3b7cdc8158c9774801d1ffc Mon Sep 17 00:00:00 2001 From: Sebastian Gerske Date: Fri, 16 Nov 2018 13:34:52 +0100 Subject: [PATCH] fix retrieveDDO and storeDDO --- src/aquarius/Aquarius.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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