Skip to content

Commit

Permalink
fix: structure change when deserializing offer
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Sep 8, 2022
1 parent 701f37c commit 7f4631a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/controllers/offer.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const commitImportedOfferFile = async (req, res) => {

await Meta.destroy({
where: {
meteKey: 'activeOffer',
metaKey: 'activeOffer',
},
});
} catch (error) {
Expand Down Expand Up @@ -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: {
Expand All @@ -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,
});
}
Expand Down
1 change: 1 addition & 0 deletions src/datalayer/persistance.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ const takeOffer = async (offer) => {
return data;
}

console.log(data);
throw new Error(data.error);
} catch (error) {
console.log(error);
Expand Down

0 comments on commit 7f4631a

Please sign in to comment.