When we save/update an exercise or workout, there is always the possibility of duplicate submission (or duplicate POST requests). The current implementation does not provide any feedback as to when the save/update operation started and when it is completed. The user of an app can knowingly or unknowingly click on the Save button multiple times due to the lack of visual clues.
Let's try to solve this problem by creating a specialized button—an Ajax button that gives some visual clues when clicked on and also stops duplicate Ajax submissions.
The button component will work on these lines. It takes a function as input. This input function (input parameter) should return a promise pertaining to the remote request. ...