If the form takes longer to submit, then we need to show some kind of loading indicator and disable the submit button so the user wouldn't hit it twice.
It's pretty easy to achieve. In the posts Composable, we need a variable isLoading
which will be true
or false
. When the button is clicked we just set it as true
.
Also, we will reset the validation errors from the previous lesson. And if there are any errors, we need to set isLoading
to false
so that we could...