mirror of
https://github.com/p-stream/p-stream.git
synced 2026-04-21 12:52:16 +00:00
Update MigrationDirect.tsx
This commit is contained in:
parent
eef2613503
commit
97674c9451
1 changed files with 13 additions and 4 deletions
|
|
@ -27,6 +27,10 @@ export function MigrationDirectPage() {
|
||||||
const updateBackendUrl = useAuthStore((state) => state.setBackendUrl);
|
const updateBackendUrl = useAuthStore((state) => state.setBackendUrl);
|
||||||
|
|
||||||
const handleMigration = useCallback(async () => {
|
const handleMigration = useCallback(async () => {
|
||||||
|
if (status === "processing") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!backendUrl) {
|
if (!backendUrl) {
|
||||||
// eslint-disable-next-line no-alert
|
// eslint-disable-next-line no-alert
|
||||||
alert("Please provide a Backend URL.");
|
alert("Please provide a Backend URL.");
|
||||||
|
|
@ -38,7 +42,6 @@ export function MigrationDirectPage() {
|
||||||
const account = await migrate(backendUrl);
|
const account = await migrate(backendUrl);
|
||||||
if (account) {
|
if (account) {
|
||||||
setStatus("success");
|
setStatus("success");
|
||||||
await logout();
|
|
||||||
updateBackendUrl(backendUrl);
|
updateBackendUrl(backendUrl);
|
||||||
} else {
|
} else {
|
||||||
setStatus("error");
|
setStatus("error");
|
||||||
|
|
@ -47,11 +50,13 @@ export function MigrationDirectPage() {
|
||||||
console.error("Error during migration:", error);
|
console.error("Error during migration:", error);
|
||||||
setStatus("error");
|
setStatus("error");
|
||||||
}
|
}
|
||||||
}, [backendUrl, migrate, updateBackendUrl, logout]);
|
}, [backendUrl, migrate, updateBackendUrl, status]);
|
||||||
|
|
||||||
const continueButton = () => {
|
const continueButton = () => {
|
||||||
if (status === "success") {
|
if (status === "success") {
|
||||||
navigate("/login");
|
logout().then(() => {
|
||||||
|
navigate("/login");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -89,7 +94,11 @@ export function MigrationDirectPage() {
|
||||||
|
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
{status !== "success" && (
|
{status !== "success" && (
|
||||||
<Button theme="purple" onClick={handleMigration}>
|
<Button
|
||||||
|
theme="purple"
|
||||||
|
onClick={handleMigration}
|
||||||
|
disabled={status === "processing"}
|
||||||
|
>
|
||||||
{status === "processing"
|
{status === "processing"
|
||||||
? t("migration.direct.button.processing")
|
? t("migration.direct.button.processing")
|
||||||
: t("migration.direct.button.migrate")}
|
: t("migration.direct.button.migrate")}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue