Skip to content

Commit

Permalink
ProductInfo returns now 204 instead of 404 in case of unknown product…
Browse files Browse the repository at this point in the history
…, fix for that
  • Loading branch information
tjjalava committed Aug 23, 2017
1 parent 22b769f commit 42b3e7c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/api/sizeme-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,15 @@ function getProduct () {
const dbItem = await fetch(
getEndpointAddress(`products/${encodeURIComponent(product.SKU)}`),
createRequest("GET")
).then(jsonResponse);
)
.then(response => {
if (response.status === 204) {
throw new ApiError("Product not found", response);
} else {
return response;
}
})
.then(jsonResponse);

const skuMap = new Map(Object.entries(product.item));
const measurements = Object.assign(
Expand Down

0 comments on commit 42b3e7c

Please sign in to comment.