i have test to make loader when fetching data with method GET, it was succesfully but when on POST method, it was failed ? what is a good way to make loader during POST data ? when on GET method, i make loader to be true and when it finish fetch data it gonna be false again, that is for GET

but when on POST method, i try something like that , make the loader to be true before post, but it was failed :( is there any example ? without the plugins or component :), i want to make own loader :D

1 Answers

Kelvin Omereshone On

I am guessing you are using a method to make the POST request, so when the method gets called, make the loader boolean true then in your fetch() or axios in the then() block make the boolean false so the logic is, when the submit button is pressed, it calls the method which starts the loader and when the POST request has been completed, the loader is set to false, you could also stop the loader in the error block if you are catching for errors.