update dashboard data and design and change req from ssr to csr & change design and data doctor and clinic item
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import HeadTab from "../content/HeadTab";
|
||||
import { request } from "@/services/response";
|
||||
import { setNewData } from "./function";
|
||||
@@ -12,6 +12,7 @@ import Surgeries from "./surgeries";
|
||||
import FamilyHistory from "./familyHistory";
|
||||
import Relatives from "./relatives";
|
||||
import { dieses } from "./information/dieses";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
function DetailUser({
|
||||
user,
|
||||
@@ -22,6 +23,8 @@ function DetailUser({
|
||||
setIsTurnsDetails,
|
||||
}) {
|
||||
const [tab, setTab] = useState(0);
|
||||
const [information, setInformation] = useState();
|
||||
const [prevInfo, setPrevInfo] = useState();
|
||||
const initialData = {
|
||||
name: dataUser?.name,
|
||||
description: dataUser?.description,
|
||||
@@ -41,6 +44,27 @@ function DetailUser({
|
||||
national_code: dataUser?.national_code,
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const user = Cookies.get("userInfo");
|
||||
const parsedUserInfo = user && JSON.parse(user);
|
||||
console.log(parsedUserInfo);
|
||||
|
||||
if (parsedUserInfo) {
|
||||
request
|
||||
.getUserProfile(parsedUserInfo.uuid)
|
||||
.then((res) => {
|
||||
setInformation(res);
|
||||
setPrevInfo(res);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
} else {
|
||||
// handle Error
|
||||
}
|
||||
}, []);
|
||||
console.log(information);
|
||||
|
||||
if (!dataUser) {
|
||||
initialData.other = [
|
||||
{
|
||||
@@ -86,9 +110,12 @@ function DetailUser({
|
||||
user={user}
|
||||
data={data}
|
||||
setData={setData}
|
||||
prevInfo={prevInfo}
|
||||
userInfo={userInfo}
|
||||
dataUser={dataUser}
|
||||
information={information}
|
||||
initialData={initialData}
|
||||
setInformation={setInformation}
|
||||
updateDataUser={updateDataUser}
|
||||
isTurnsDetails={isTurnsDetails}
|
||||
setIsTurnsDetails={setIsTurnsDetails}
|
||||
|
||||
Reference in New Issue
Block a user