Skip to content

Commit

Permalink
fix(global): 🐛 profilebasic info edit logo validation
Browse files Browse the repository at this point in the history
profilebasic info edit logo validation

Ref: #56
  • Loading branch information
PritamIT2023 committed Jun 25, 2024
1 parent 2ce47de commit 7224008
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions app/formValidationMap.registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,17 @@ export const ValidationsRegistry = {
string()
.trim()
.matches(/^[a-zA-Z\s]+$/, "Only alphabets are allowed for this field "),
photo: mixed()
.test("fileSize", "File size must be less than 5MB", (value) => {
if (!value) return true;
return value.size <= 5242880;
}),
photo: mixed().when("myfile", {
isType : (value) => typeof value === "string",
// Allow null for strings
otherwise: (schema) =>
schema
.test("fileSize", "File size must be less than 5MB", (value) => {
if (!value) return true; // Allow empty files
return value.size <= 5 * 1024 * 1024; // Check for 5MB limit
}),
then: (schema) => schema.nullable(true),
}),
},
profileEducation: {
board:
Expand Down

0 comments on commit 7224008

Please sign in to comment.