Disabled-Create-Customer-Button-Until-Name-Id-Or-Email-isfilled-to-Prevent-API-CALL
This commit is contained in:
@@ -75,14 +75,18 @@ function CreateCustomer() {
|
|||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<div>
|
<div>
|
||||||
<FieldLabel>Name</FieldLabel>
|
<FieldLabel>
|
||||||
|
Name
|
||||||
|
</FieldLabel>
|
||||||
<Input
|
<Input
|
||||||
value={fields.name}
|
value={fields.name}
|
||||||
onChange={(e) => setFields({ ...fields, name: e.target.value })}
|
onChange={(e) => setFields({ ...fields, name: e.target.value })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<FieldLabel>ID</FieldLabel>
|
<FieldLabel>
|
||||||
|
ID
|
||||||
|
</FieldLabel>
|
||||||
<Input
|
<Input
|
||||||
value={fields.id}
|
value={fields.id}
|
||||||
onChange={(e) => setFields({ ...fields, id: e.target.value })}
|
onChange={(e) => setFields({ ...fields, id: e.target.value })}
|
||||||
@@ -107,12 +111,11 @@ function CreateCustomer() {
|
|||||||
/>
|
/>
|
||||||
</div> */}
|
</div> */}
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button
|
<Button onClick={handleCreate}
|
||||||
onClick={handleCreate}
|
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
variant="gradientPrimary"
|
variant="gradientPrimary"
|
||||||
>
|
disabled={ !fields.name.trim() || (!fields.id.trim() && !fields.email.trim()) }
|
||||||
Create
|
> Create
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|||||||
Reference in New Issue
Block a user