handle save some data and send server correct & change component form & clean code & fix bugs
This commit is contained in:
@@ -12,7 +12,10 @@ export const transformData = (data) => {
|
||||
activity_time: dateToTimestamp(data.time_work.value),
|
||||
doctor_mobile_number: data.phone.value,
|
||||
degree: data.degree.value,
|
||||
specialty: [Number(data.expertise.value)],
|
||||
specialty: [data.expertise.value],
|
||||
info: data.description.value,
|
||||
doctor_id: data.medical_system_number.value,
|
||||
doctor_services: data.skills.value,
|
||||
gender: data.gender.value,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -27,6 +27,7 @@ function SendReq({ img, data, resetData }) {
|
||||
};
|
||||
|
||||
const saveImg = () => {
|
||||
resetData();
|
||||
setLoading(true);
|
||||
if (img) {
|
||||
request
|
||||
@@ -35,7 +36,7 @@ function SendReq({ img, data, resetData }) {
|
||||
const imgId = res.fid[0].value;
|
||||
saveData(imgId);
|
||||
})
|
||||
.catch((err) => {
|
||||
.catch(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
} else {
|
||||
@@ -47,7 +48,6 @@ function SendReq({ img, data, resetData }) {
|
||||
<div className="mt-[40px] w-full flex justify-end">
|
||||
<Button
|
||||
className="!w-full md:!w-fit !shadow-none !rounded-[4px] !gap-[4px] !text-[#EFEFEF] !text-[14px] md:!text-[16px] !font-medium"
|
||||
// onClick={() => setValue((prev) => prev + 1)}
|
||||
disabled={!checkAllValues(data)}
|
||||
variant="contained"
|
||||
onClick={saveImg}
|
||||
|
||||
Reference in New Issue
Block a user