diff --git a/aeye/app/(nav)/my/page.tsx b/aeye/app/(nav)/my/page.tsx index a4ba9b4..4058522 100644 --- a/aeye/app/(nav)/my/page.tsx +++ b/aeye/app/(nav)/my/page.tsx @@ -20,22 +20,70 @@ const Item = styled(Paper)(({ theme }) => ({ margin: theme.spacing(1), })); +type Member = { + id: number; + name: string; + email: string; + profileUri: string; + oauth2Id: string; + phone: string; + socialLogin: string; + admin: boolean; +}; + +function stringAvatar(name: string | undefined) { + return { + children: `${name?.split(" ")[0][0]}${name?.split(" ")[1][0]}`, + }; +} + function ProfileAvatar() { - const [avatar, setAvatar] = useState(null); - return ( -
- - - - - 사람이름 - -
- ); + const [member, setMember] = useState(null); + + const fetchMember = async () => { + try { + const res = await fetch("https://api.a-eye.live/member/detail", { + method: "GET", + headers: { + Authorization: `Bearer ${localStorage.getItem("accessToken")}`, + }, + }); + if (res.ok) { + const jsonData = await res.json(); + setMember(jsonData.data); + } + } catch (err) { + console.log(err); + } + }; + + useEffect(() => { + fetchMember(); + }, []); + + return ( +
+ + {member?.profileUri ? ( + + ) : ( + + )} + + + {member?.name} + + + {member?.email} {member?.phone} + +
+ ); } export default function MyPage() {