mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-08 13:38:33 +02:00
Add loading back to create resource
This commit is contained in:
@@ -80,7 +80,6 @@ import { toASCII } from "punycode";
|
|||||||
import {
|
import {
|
||||||
useMemo,
|
useMemo,
|
||||||
useState,
|
useState,
|
||||||
useTransition,
|
|
||||||
useEffect
|
useEffect
|
||||||
} from "react";
|
} from "react";
|
||||||
import { useForm, type Resolver } from "react-hook-form";
|
import { useForm, type Resolver } from "react-hook-form";
|
||||||
@@ -229,7 +228,7 @@ export default function Page() {
|
|||||||
>([]);
|
>([]);
|
||||||
const [loadingExitNodes, setLoadingExitNodes] = useState(build === "saas");
|
const [loadingExitNodes, setLoadingExitNodes] = useState(build === "saas");
|
||||||
|
|
||||||
const [createLoading, startTransition] = useTransition();
|
const [createLoading, setCreateLoading] = useState(false);
|
||||||
const [showSnippets, setShowSnippets] = useState(false);
|
const [showSnippets, setShowSnippets] = useState(false);
|
||||||
const [niceId, setNiceId] = useState<string>("");
|
const [niceId, setNiceId] = useState<string>("");
|
||||||
|
|
||||||
@@ -461,6 +460,7 @@ export default function Page() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
|
setCreateLoading(true);
|
||||||
const baseData = baseForm.getValues();
|
const baseData = baseForm.getValues();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -707,6 +707,8 @@ export default function Page() {
|
|||||||
t("resourceErrorCreateMessageDescription")
|
t("resourceErrorCreateMessageDescription")
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
|
setCreateLoading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1427,7 +1429,7 @@ export default function Page() {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
loading={createLoading}
|
loading={createLoading}
|
||||||
disabled={!areAllTargetsValid() || browserGatewayDisabled}
|
disabled={!areAllTargetsValid() || browserGatewayDisabled || createLoading}
|
||||||
>
|
>
|
||||||
{t("resourceCreate")}
|
{t("resourceCreate")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user