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

calling destroy on model Uncaught (in promise) #47

Closed
jkeruzec opened this issue Jun 28, 2018 · 2 comments
Closed

calling destroy on model Uncaught (in promise) #47

jkeruzec opened this issue Jun 28, 2018 · 2 comments

Comments

@jkeruzec
Copy link

I'm trying to destroy a model from a collection I have using destroy method.

 deleteProject(value) {
        // Delete project
        projectsCollection.get(value).destroy({optimistic: false});
        projectsCollection.remove([value]);
    }

Destroy is done well on my Rest call that return a 200 OK response.

image

But console display an error message :

asyncToGenerator.js:20 Uncaught (in promise) {}

error is empty and I don't get it ...

It is not a blocker for me but it's not very clean either..

Thanks for your help !

@jkeruzec
Copy link
Author

I explore a bit more this issue and found that DELETE order must return a JSON response in order to not reject the call....

In some normalization, a 200 OK response on a DELETE order can send a description status in body response.
I also read that a 204 No Content on a DELETE order send an empty body

Some information... :
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE

geclos added a commit to geclos/mobx-rest that referenced this issue May 10, 2019
@geclos
Copy link
Collaborator

geclos commented May 10, 2019

Hi @jkeruzec,

it's been a long time since this issue was reported. Did you manage to fix it by yourself? If not, which adapter are you experiencing this issue with?

We use mobx-rest with the jQuery adapter extensively at Factorial with an API that returns DELETE 204 without body and we haven't been able to reproduce this issue.

@geclos geclos mentioned this issue May 17, 2019
10 tasks
@geclos geclos closed this as completed in 26f1397 May 31, 2019
geclos added a commit to geclos/mobx-rest that referenced this issue May 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants