added async loading state
This commit is contained in:
@@ -24,8 +24,8 @@ const BearerTypeFields = () => {
|
|||||||
verbose: verbose === "true",
|
verbose: verbose === "true",
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = (values: BearerTypeFieldType) => {
|
const handleSubmit = async (values: BearerTypeFieldType) => {
|
||||||
dispatcherMutation.mutate(values);
|
await dispatcherMutation.mutateAsync(values);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -34,6 +34,7 @@ const BearerTypeFields = () => {
|
|||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
enableReinitialize
|
enableReinitialize
|
||||||
>
|
>
|
||||||
|
{({ isSubmitting }) => (
|
||||||
<Form>
|
<Form>
|
||||||
<div className="flex flex-col space-y-4 px-2">
|
<div className="flex flex-col space-y-4 px-2">
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
@@ -61,10 +62,13 @@ const BearerTypeFields = () => {
|
|||||||
type="submit"
|
type="submit"
|
||||||
className="bg-[#26B170] text-white px-4 py-2 rounded hover:bg-green-700 transition w-full md:w-[50%]"
|
className="bg-[#26B170] text-white px-4 py-2 rounded hover:bg-green-700 transition w-full md:w-[50%]"
|
||||||
>
|
>
|
||||||
Save Changes
|
{isSubmitting || dispatcherMutation.isPending
|
||||||
|
? "Saving..."
|
||||||
|
: "Save Changes"}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
|
)}
|
||||||
</Formik>
|
</Formik>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ const ChannelFields = () => {
|
|||||||
readTimeoutSeconds: Number(readTimeoutSeconds),
|
readTimeoutSeconds: Number(readTimeoutSeconds),
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = (values: InitialValuesForm) => {
|
const handleSubmit = async (values: InitialValuesForm) => {
|
||||||
backOfficeMutation.mutate(values);
|
await backOfficeMutation.mutateAsync(values);
|
||||||
};
|
};
|
||||||
|
|
||||||
const ValidationToastOnce = () => {
|
const ValidationToastOnce = () => {
|
||||||
@@ -84,7 +84,7 @@ const ChannelFields = () => {
|
|||||||
enableReinitialize
|
enableReinitialize
|
||||||
validate={validateValues}
|
validate={validateValues}
|
||||||
>
|
>
|
||||||
{({ errors, touched }) => (
|
{({ errors, touched, isSubmitting }) => (
|
||||||
<Form>
|
<Form>
|
||||||
<div className="flex flex-col space-y-2 px-2">
|
<div className="flex flex-col space-y-2 px-2">
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
@@ -172,7 +172,9 @@ const ChannelFields = () => {
|
|||||||
type="submit"
|
type="submit"
|
||||||
className="bg-[#26B170] text-white px-4 py-2 rounded hover:bg-green-700 transition w-full md:w-[50%]"
|
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>
|
</button>
|
||||||
<ValidationToastOnce />
|
<ValidationToastOnce />
|
||||||
</Form>
|
</Form>
|
||||||
|
|||||||
Reference in New Issue
Block a user