Skip to content

Commit

Permalink
adjustments for switching to users
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrichardsmith committed Aug 22, 2016
1 parent dddc18f commit 02af0ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions api/orders/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
}
console.log("Received response: " + JSON.stringify(body));
var jsonBody = JSON.parse(body);
var customerlink = jsonBody._links.customer.href;
var addressLink = jsonBody._links.addresses.href;
var cardLink = jsonBody._links.cards.href;
var customerlink = jsonBody._embedded.customer[0]._links.customer.href;
var addressLink = jsonBody._embedded.customer[0].addresses[0]._links.address.href;
var cardLink = jsonBody._embedded.customer[0].cards[0]._links.card.href;
var order = {
"customer": customerlink,
"address": null,
Expand Down
4 changes: 2 additions & 2 deletions public/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ function addToCart(id) {
function username(id, callback) {
console.log("Requesting user account information " + id);
$.ajax({
url: "accounts/" + id,
url: "customers/" + id,
type: "GET",
success: function (data, textStatus, jqXHR) {
callback(JSON.parse(data).firstName + " " + JSON.parse(data).lastName);
callback(JSON.parse(data)._embedded.customer[0].firstName + " " + JSON.parse(data)._embedded.customer[0].lastName);
},
error: function (jqXHR, textStatus, errorThrown) {
console.error('Could not get user information: ' + id + ', due to: ' + textStatus + ' | ' + errorThrown);
Expand Down

0 comments on commit 02af0ce

Please sign in to comment.