Skip to content

Commit

Permalink
[IMP] Allow blank API response
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultrey committed Feb 12, 2024
1 parent 0d7f10f commit 4fda0d5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,13 @@ export class Cart {
'response'
);
if (response.ok) {
this.erpCart = await response.json();
if (response.status === 204) {
/** New Cart */
this.erpCart = null;
} else {
this.erpCart = await response.json();
}

if (Object.keys(this.erpCart).length === 0) {
// an empty object means no cart
this.erpCart = null;
Expand Down

0 comments on commit 4fda0d5

Please sign in to comment.