Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to persist cart update #146

Open
kvedantmahajan opened this issue Aug 13, 2018 · 6 comments
Open

Not able to persist cart update #146

kvedantmahajan opened this issue Aug 13, 2018 · 6 comments
Labels
Projects

Comments

@kvedantmahajan
Copy link

kvedantmahajan commented Aug 13, 2018

Here's my code for _saveCart

_saveCart() { this._onItemsUpdated(); return fetch(${API_ENDPOINT}api/cart/items, { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ data: this.items }) }).then(res => res.json()) .then(res => res.data) .catch(error => console.error(error)); }

PUT request is successful. However, as I refresh the page, data is gone.

Where should I look for to add missing pieces to work it around?

@mike-north
Copy link
Member

@kushalmahajan Can you push your code to github so I can take a look?

@kvedantmahajan
Copy link
Author

@kvedantmahajan
Copy link
Author

kvedantmahajan commented Aug 13, 2018

I checked terminal and there on refreshing the page there is this error -

Unhandled rejection TypeError: Cannot read property 'map' of undefined at

divideCartWork (/Users/vedant/Projects/pwa-fundamentals/server/api-server/routes/cart/update-items.js:15:25)

@kvedantmahajan
Copy link
Author

Nothing seems to work fine after this error. There is a failed fetch request for

GET https://localhost:3000/order/web-app-manifest.json 404 (Not Found)

Manifest: Line: 1, column: 1, Unexpected token.

And my service worker will not install after this :(

@mike-north
Copy link
Member

mike-north commented Aug 13, 2018 via email

@kvedantmahajan
Copy link
Author

kvedantmahajan commented Aug 13, 2018 via email

@mike-north mike-north added this to Todo in Support Sep 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

2 participants