fix: disable button and handle submit when loading (#5496)

pull/5495/head^2
Udit Takkar 2022-11-12 19:01:11 +05:30 committed by GitHub
parent 0cb278d109
commit d7226fc3d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 3 deletions

View File

@ -38,7 +38,11 @@ export const CreateANewTeamForm = () => {
return (
<>
<Form form={newTeamFormMethods} handleSubmit={(v) => createTeamMutation.mutate(v)}>
<Form
form={newTeamFormMethods}
handleSubmit={(v) => {
if (!createTeamMutation.isLoading) createTeamMutation.mutate(v);
}}>
<div className="mb-8">
<Controller
name="name"
@ -113,10 +117,19 @@ export const CreateANewTeamForm = () => {
</div>
<div className="flex space-x-2">
<Button color="secondary" href="/settings" className="w-full justify-center">
<Button
disabled={createTeamMutation.isLoading}
color="secondary"
href="/settings"
className="w-full justify-center">
{t("cancel")}
</Button>
<Button color="primary" type="submit" EndIcon={Icon.FiArrowRight} className="w-full justify-center">
<Button
disabled={createTeamMutation.isLoading}
color="primary"
type="submit"
EndIcon={Icon.FiArrowRight}
className="w-full justify-center">
{t("continue")}
</Button>
</div>