refactor: enhance form validation and error handling in EditField, DefaultSelect, and Form components
This commit is contained in:
@@ -11,6 +11,7 @@ const defaultData = {
|
||||
name: { value: "", isEdit: true },
|
||||
family: { value: "", isEdit: true },
|
||||
gender: { value: "", isEdit: true },
|
||||
insurance_id: { value: "", isEdit: true },
|
||||
basic_insurance: { value: "", isEdit: true },
|
||||
};
|
||||
|
||||
@@ -50,6 +51,7 @@ function AppointmentPage({ doctor, disabledDates, matchedCity }) {
|
||||
// سپس اگر uuid داریم، بقیه اطلاعات را از API میگیریم
|
||||
if (userInfo && parsedData) {
|
||||
try {
|
||||
console.log('📤 درخواست دریافت پروفایل کاربر - UUID:', parsedData.uuid);
|
||||
const res = await request.getUserProfile(parsedData.uuid);
|
||||
|
||||
if (res) {
|
||||
@@ -63,6 +65,7 @@ function AppointmentPage({ doctor, disabledDates, matchedCity }) {
|
||||
name: { value: res.name || "", isEdit: true },
|
||||
family: { value: res.family || "", isEdit: true },
|
||||
gender: { value: res.gender || "", isEdit: true },
|
||||
insurance_id: { value: res.insurance_id || "", isEdit: true },
|
||||
basic_insurance: {
|
||||
value: res.basic_insurance,
|
||||
isEdit: true,
|
||||
@@ -80,6 +83,7 @@ function AppointmentPage({ doctor, disabledDates, matchedCity }) {
|
||||
name: { value: "", isEdit: true },
|
||||
family: { value: "", isEdit: true },
|
||||
gender: { value: "", isEdit: true },
|
||||
insurance_id: { value: "", isEdit: true },
|
||||
basic_insurance: { value: "", isEdit: true },
|
||||
}));
|
||||
}
|
||||
@@ -104,6 +108,7 @@ function AppointmentPage({ doctor, disabledDates, matchedCity }) {
|
||||
|
||||
if (userInfo && parsedData && !data.uuid) {
|
||||
try {
|
||||
console.log('📤 درخواست مجدد دریافت پروفایل (step 3) - UUID:', parsedData.uuid);
|
||||
const res = await request.getUserProfile(parsedData.uuid);
|
||||
|
||||
if (res) {
|
||||
@@ -117,6 +122,7 @@ function AppointmentPage({ doctor, disabledDates, matchedCity }) {
|
||||
name: { value: res.name || "", isEdit: true },
|
||||
family: { value: res.family || "", isEdit: true },
|
||||
gender: { value: res.gender || "", isEdit: true },
|
||||
insurance_id: { value: res.insurance_id || "", isEdit: true },
|
||||
basic_insurance: {
|
||||
value: res.basic_insurance,
|
||||
isEdit: true,
|
||||
@@ -134,6 +140,7 @@ function AppointmentPage({ doctor, disabledDates, matchedCity }) {
|
||||
name: { value: "", isEdit: true },
|
||||
family: { value: "", isEdit: true },
|
||||
gender: { value: "", isEdit: true },
|
||||
insurance_id: { value: "", isEdit: true },
|
||||
basic_insurance: { value: "", isEdit: true },
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user