fix: ui state

This commit is contained in:
Daniel Hougaard
2025-07-24 19:14:50 +04:00
parent 716b88fa49
commit 4af872e504
2 changed files with 35 additions and 36 deletions
@@ -45,25 +45,21 @@ export const EnvKeyPlatformModal = ({ onClose }: Props) => {
return; return;
} }
try { await importEnvKey({
await importEnvKey({ file: data.file,
file: data.file, decryptionKey: data.encryptionKey
decryptionKey: data.encryptionKey });
}); createNotification({
createNotification({ title: "Import started",
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.",
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"
type: "info" });
});
onClose(); onClose();
reset(); reset();
if (fileUploadRef.current) { if (fileUploadRef.current) {
fileUploadRef.current.value = ""; fileUploadRef.current.value = "";
}
} catch {
reset();
} }
}; };
@@ -74,30 +74,33 @@ export const VaultPlatformModal = ({ onClose }: Props) => {
control, control,
handleSubmit, handleSubmit,
reset, reset,
formState: { isLoading, isDirty, isSubmitting, isValid } formState: { isLoading, isDirty, isSubmitting, isValid, errors }
} = useForm<TFormData>({ } = useForm<TFormData>({
resolver: zodResolver(formSchema) resolver: zodResolver(formSchema)
}); });
const onSubmit = async (data: TFormData) => { console.log({
try { isSubmitting,
await importVault({ isLoading,
vaultAccessToken: data.vaultAccessToken, isValid,
vaultNamespace: data.vaultNamespace, errors
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(); const onSubmit = async (data: TFormData) => {
reset(); await importVault({
} catch { vaultAccessToken: data.vaultAccessToken,
reset(); 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 ( return (