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

Best Practice for adding/removing on a REST/API error #179

Open
rpcollins opened this issue Dec 30, 2016 · 0 comments
Open

Best Practice for adding/removing on a REST/API error #179

rpcollins opened this issue Dec 30, 2016 · 0 comments

Comments

@rpcollins
Copy link

Apologies if this is an easy thing to do, but I'm struggling to find an answer in the Issues and it didn't seem obvious to me, but how can I handle removing or adding a selection if the API call fails. To give some background, when a selection is made or removed, we make the REST call to add or remove from the backend. If the REST call fails, the item is still in the selectize box, because it adds it to the UI/input field before the rest call completes. I feel like I must be missing something, but basically, is there a way to add the selection to the UI only after the REST call has been made? For reference, I am doing a model.save() when a selection is made. I tried to handle it in the error callback, but element is already added to the UI at the point, so I feel like I am missing something. Thanks.

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

1 participant