Skip to content
This repository was archived by the owner on Mar 21, 2021. It is now read-only.

fix issue Error Placing Order #64 #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const create = ({
};

const checkSuccess = res => {
if (res.status !== 0) {
throw Error(res.message);
if (res.errors !== undefined && res.errors !== null) {
throw Error(res.errors[0].text);
}
return res;
};
Expand Down Expand Up @@ -419,7 +419,7 @@ const create = ({
)
.then(res => res.json())
.then(checkSuccess)
.then(json => ({order, confirmationId: json.confirmationId}));
.then(json => ({order, confirmationId: json.data.confirmationId}));
};

/**
Expand All @@ -443,7 +443,7 @@ const create = ({
)
.then(res => res.json())
.then(checkSuccess)
.then(json => ({orderId: json.orderId}));
.then(json => ({orderId: json.data.orderId}));
};

/**
Expand Down