From 7f4631a20f9b58d0c42fff814a8bade430f303ed Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Thu, 8 Sep 2022 13:14:00 -0400 Subject: [PATCH] fix: structure change when deserializing offer --- src/controllers/offer.controller.js | 9 +++++---- src/datalayer/persistance.js | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/controllers/offer.controller.js b/src/controllers/offer.controller.js index fa76d40c..6e0b45fa 100644 --- a/src/controllers/offer.controller.js +++ b/src/controllers/offer.controller.js @@ -105,7 +105,7 @@ export const commitImportedOfferFile = async (req, res) => { await Meta.destroy({ where: { - meteKey: 'activeOffer', + metaKey: 'activeOffer', }, }); } catch (error) { @@ -141,10 +141,11 @@ export const getCurrentOfferInfo = async (req, res) => { where: { metaKey: 'activeOffer' }, raw: true, }); + const offerFile = JSON.parse(offerFileJson.metaValue); - const makerChanges = deserializeMaker(offerFile.maker); - const takerChanges = deserializeTaker(offerFile.taker); + const makerChanges = deserializeMaker(offerFile.offer.maker); + const takerChanges = deserializeTaker(offerFile.offer.taker); res.status(200).json({ changes: { @@ -155,7 +156,7 @@ export const getCurrentOfferInfo = async (req, res) => { } catch (error) { console.trace(error); res.status(400).json({ - message: 'Can not cancel offer.', + message: 'Can not get offer.', error: error.message, }); } diff --git a/src/datalayer/persistance.js b/src/datalayer/persistance.js index 9cd26aee..87042d1f 100644 --- a/src/datalayer/persistance.js +++ b/src/datalayer/persistance.js @@ -531,6 +531,7 @@ const takeOffer = async (offer) => { return data; } + console.log(data); throw new Error(data.error); } catch (error) { console.log(error);