-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error handling and user guidance in registration form file up…
…loads
- Loading branch information
1 parent
f43b923
commit 10cc9bc
Showing
1 changed file
with
7 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,6 @@ export default function RegistrationForm() { | |
toast.error("No files uploaded. Please try again."); | ||
return; | ||
} | ||
|
||
try { | ||
if (res.length === 2) { | ||
form.setValue("idCard", res[0].url); | ||
|
@@ -116,7 +115,7 @@ export default function RegistrationForm() { | |
}, | ||
onUploadError: (error) => { | ||
console.error("Upload error:", error); | ||
toast.error("Image upload failed. Please try again later."); | ||
toast.error("Image upload failed. Please inform us at [email protected] or click the contact us button at buttom right corner."); | ||
}, | ||
}); | ||
|
||
|
@@ -185,8 +184,12 @@ export default function RegistrationForm() { | |
const allFiles = uploadedFiles.flatMap((file) => file.files); | ||
|
||
if (allFiles.length > 0) { | ||
await startUpload(allFiles); | ||
toast.success("✅ Files uploaded successfully!"); | ||
const uploadResult = await startUpload(allFiles); | ||
if (!uploadResult) { | ||
toast.error("Error uploading files. Please contact support from the contact us button at buttom right corner."); | ||
}else{ | ||
toast.success("✅ Files uploaded successfully!"); | ||
} | ||
} else { | ||
toast.warning("⚠️ No files to upload."); | ||
} | ||
|