Skip to content

Commit 1b8bd11

Browse files
committed
Fix chatwoot data onSubmit
EvolutionAPI/evolution-api#847
1 parent 04819d1 commit 1b8bd11

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/pages/instance/Chatwoot/index.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,9 @@ function Chatwoot() {
8282
}
8383
});
8484

85-
const onSubmit = async () => {
85+
const onSubmit = async (data: FormSchema) => {
8686
if (!instance) return;
8787

88-
const data = form.getValues();
89-
9088
setLoading(true);
9189
const chatwootData: ChatwootType = {
9290
enabled: data.enabled,
@@ -136,7 +134,10 @@ function Chatwoot() {
136134
return (
137135
<>
138136
<Form {...form}>
139-
<form className="w-full space-y-6">
137+
<form
138+
onSubmit={form.handleSubmit(onSubmit)}
139+
className="w-full space-y-6"
140+
>
140141
<div>
141142
<h3 className="mb-1 text-lg font-medium">{t("chatwoot.title")}</h3>
142143
<Separator className="my-4" />
@@ -231,9 +232,7 @@ function Chatwoot() {
231232
</div>
232233
</div>
233234
<div className="mx-4 flex justify-end">
234-
<Button type="submit" onClick={onSubmit}>
235-
{t("chatwoot.button.save")}
236-
</Button>
235+
<Button type="submit">{t("chatwoot.button.save")}</Button>
237236
</div>
238237
</form>
239238
</Form>

0 commit comments

Comments
 (0)