redirect filter data to doctors page from home page just with one key && add picture url to doctors page && add conditional to appo page and change data in server
This commit is contained in:
@@ -24,7 +24,7 @@ function AppointmentPage({ slug, matchedCity }) {
|
||||
|
||||
useEffect(() => {
|
||||
const userInfo = Cookies.get("userInfo");
|
||||
const parsedData = JSON.parse(userInfo);
|
||||
const parsedData = userInfo && JSON.parse(userInfo);
|
||||
|
||||
if (userInfo && parsedData) {
|
||||
request
|
||||
@@ -32,8 +32,12 @@ function AppointmentPage({ slug, matchedCity }) {
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
const newData = {
|
||||
uuid: res.uuid,
|
||||
phone: { value: parsedData.username || "", isEdit: false },
|
||||
national_code: { value: res.national_code || "", isEdit: true },
|
||||
national_code: {
|
||||
value: res.national_code || "",
|
||||
isEdit: res.national_code ? false : true,
|
||||
},
|
||||
name: { value: `${res.name} ${res.family}`, isEdit: true },
|
||||
basic_insurance: {
|
||||
value: res.basic_insurance,
|
||||
@@ -44,6 +48,7 @@ function AppointmentPage({ slug, matchedCity }) {
|
||||
setPrevData(newData);
|
||||
} else {
|
||||
const emptyData = {
|
||||
uuid: res.uuid,
|
||||
phone: { value: parsedData.username || "", isEdit: false },
|
||||
national_code: { value: "", isEdit: true },
|
||||
name: { value: "", isEdit: true },
|
||||
@@ -56,8 +61,8 @@ function AppointmentPage({ slug, matchedCity }) {
|
||||
setPrevData(emptyData);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
.catch(() => {
|
||||
//
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
@@ -69,6 +74,7 @@ function AppointmentPage({ slug, matchedCity }) {
|
||||
doctor={doctor}
|
||||
setData={setData}
|
||||
setStep={setStep}
|
||||
prevData={prevData}
|
||||
matchedCity={matchedCity}
|
||||
isForAnother={isForAnother}
|
||||
setIsForAnother={setIsForAnother}
|
||||
|
||||
Reference in New Issue
Block a user