added async loading state

This commit is contained in:
2025-10-07 14:05:27 +01:00
parent c2c2fc76f2
commit d927767677
2 changed files with 42 additions and 36 deletions

View File

@@ -30,8 +30,8 @@ const ChannelFields = () => {
readTimeoutSeconds: Number(readTimeoutSeconds),
};
const handleSubmit = (values: InitialValuesForm) => {
backOfficeMutation.mutate(values);
const handleSubmit = async (values: InitialValuesForm) => {
await backOfficeMutation.mutateAsync(values);
};
const ValidationToastOnce = () => {
@@ -84,7 +84,7 @@ const ChannelFields = () => {
enableReinitialize
validate={validateValues}
>
{({ errors, touched }) => (
{({ errors, touched, isSubmitting }) => (
<Form>
<div className="flex flex-col space-y-2 px-2">
<FormGroup>
@@ -172,7 +172,9 @@ const ChannelFields = () => {
type="submit"
className="bg-[#26B170] text-white px-4 py-2 rounded hover:bg-green-700 transition w-full md:w-[50%]"
>
Save Changes
{isSubmitting || backOfficeMutation.isPending
? "Saving..."
: "Save Changes"}
</button>
<ValidationToastOnce />
</Form>