handle validate field in step 3 page add-doctor
This commit is contained in:
+8
-3
@@ -27,17 +27,22 @@ export const checkAllValues = (data) => {
|
||||
if (typeof data[key] === "object" && data[key] !== null) {
|
||||
if ("value" in data[key]) {
|
||||
if (!data[key].value) {
|
||||
console.log(false);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!checkAllValues(data[key])) {
|
||||
console.log(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(true);
|
||||
return true;
|
||||
};
|
||||
|
||||
export const checkTimes = (arr) => {
|
||||
return arr.map((day) => {
|
||||
const hasMorningTime = day.morning_time.some((time) => time !== "");
|
||||
const hasEveningTime = day.evening_time.some((time) => time !== "");
|
||||
return hasMorningTime && hasEveningTime;
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user