Answer the question
In order to leave comments, you need to log in
How do you implement such logic in your applications?
Let's say a product needs to be added to the cart or favorites, and feedback needs to be given. The user clicks on the button. There are 2 scenarios:
1. A request is sent to the server, a response comes. If successful, it shows that "added ..."
2. Show that "added ...", and it doesn't matter if it was added / not added. Only then do you send a request.
The 1st looks logical, but the answer is not so fast, you have to show the progressbar.
The 2nd can lie to the user: if the connection is lost or the server returns an error, then before that there will be a message about adding, but in the end nothing will be added
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question