From 4af872e504ffecf622c229c8bc21a9a7bcc2d149 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Thu, 24 Jul 2025 19:14:50 +0400 Subject: [PATCH] fix: ui state --- .../components/EnvKeyPlatformModal.tsx | 30 ++++++-------- .../components/VaultPlatformModal.tsx | 41 ++++++++++--------- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/EnvKeyPlatformModal.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/EnvKeyPlatformModal.tsx index 55b360365..2c15cfb8a 100644 --- a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/EnvKeyPlatformModal.tsx +++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/EnvKeyPlatformModal.tsx @@ -45,25 +45,21 @@ export const EnvKeyPlatformModal = ({ onClose }: Props) => { return; } - try { - await importEnvKey({ - file: data.file, - decryptionKey: data.encryptionKey - }); - createNotification({ - title: "Import started", - text: "Your data is being imported. You will receive an email when the import is complete or if the import fails. This may take up to 10 minutes.", - type: "info" - }); + await importEnvKey({ + file: data.file, + decryptionKey: data.encryptionKey + }); + createNotification({ + title: "Import started", + text: "Your data is being imported. You will receive an email when the import is complete or if the import fails. This may take up to 10 minutes.", + type: "info" + }); - onClose(); - reset(); + onClose(); + reset(); - if (fileUploadRef.current) { - fileUploadRef.current.value = ""; - } - } catch { - reset(); + if (fileUploadRef.current) { + fileUploadRef.current.value = ""; } }; diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultPlatformModal.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultPlatformModal.tsx index f4507da4c..02ab5df1b 100644 --- a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultPlatformModal.tsx +++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultPlatformModal.tsx @@ -74,30 +74,33 @@ export const VaultPlatformModal = ({ onClose }: Props) => { control, handleSubmit, reset, - formState: { isLoading, isDirty, isSubmitting, isValid } + formState: { isLoading, isDirty, isSubmitting, isValid, errors } } = useForm({ resolver: zodResolver(formSchema) }); - const onSubmit = async (data: TFormData) => { - try { - await importVault({ - vaultAccessToken: data.vaultAccessToken, - vaultNamespace: data.vaultNamespace, - vaultUrl: data.vaultUrl, - mappingType: data.mappingType - }); - createNotification({ - title: "Import started", - text: "Your data is being imported. You will receive an email when the import is complete or if the import fails. This may take up to 10 minutes.", - type: "info" - }); + console.log({ + isSubmitting, + isLoading, + isValid, + errors + }); - onClose(); - reset(); - } catch { - reset(); - } + const onSubmit = async (data: TFormData) => { + await importVault({ + vaultAccessToken: data.vaultAccessToken, + vaultNamespace: data.vaultNamespace, + vaultUrl: data.vaultUrl, + mappingType: data.mappingType + }); + createNotification({ + title: "Import started", + text: "Your data is being imported. You will receive an email when the import is complete or if the import fails. This may take up to 10 minutes.", + type: "info" + }); + + onClose(); + reset(); }; return (