Skip to content

Commit

Permalink
[style]: 알바생 마이페이지에 하드코딩 없애기(내 정보 관련)
Browse files Browse the repository at this point in the history
  • Loading branch information
jennyjoo committed Jul 3, 2024
1 parent 1077c38 commit 924066b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/pages/employee/MyPageTab/MyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import Frame from '../../../components/Frame';
import Wrapper from '../../../components/Wrapper';
import WhiteBox from '../../../components/ui/WhiteBox';
import WorkPlaceName from '../../../components/ui/WorkPlaceName';
import ToolBar2 from '../../../components/ui/ToolBar2';
import { useEffect, useState } from 'react';
import ApiClient from '../../../api/apiClient';
import ModalBottom from '../../../components/ModalBottom';
import { formatDate, styleDate } from '../../../utils/format-date';
import ToolBarLink from '../../../components/ui/ToolBarLink';
import { EmployeeMenuList } from '../datas';

Expand All @@ -17,6 +15,7 @@ const MyPage = () => {
const [paperDetail, setPaperDetail] =
useState<EmployeePaperGetResponse | null>(null);
const [isModalOpen, setModalOpen] = useState<boolean>(false);
const [myInfo, setMyInfo] = useState<MyInfo | null>(null);
const [modalMsg, setModalMsg] = useState<string>('');

const openModal = (msg?: string) => {
Expand All @@ -43,6 +42,17 @@ const MyPage = () => {
}
};

const getMyInfo = async () => {
try {
const response: MyInfo =
await ApiClient.getInstance().employeeGetMyInfo();

setMyInfo(response);
} catch (err) {
console.error(err);
}
};

const fetchData = async () => {
try {
const response: EmploymentContractListGetResponse[] =
Expand All @@ -57,6 +67,7 @@ const MyPage = () => {

useEffect(() => {
fetchData();
getMyInfo();
}, []);
return (
<>
Expand Down Expand Up @@ -157,17 +168,17 @@ const MyPage = () => {
{/* 성명 */}
<div className='flex justify-between'>
<div>성명</div>
<div className='text-gray-400'>이름</div>
<div className='text-gray-400'>{myInfo?.username}</div>
</div>
{/* 전화번호 */}
<div className='flex justify-between'>
<div>전화번호</div>
<div className='text-gray-400'>이름</div>
<div className='text-gray-400'>{myInfo?.phoneNumber}</div>
</div>
{/* 계좌번호 */}
<div className='flex justify-between'>
<div>계좌번호</div>
<div className='text-gray-400'>이름</div>
<div className='text-gray-400'>{myInfo?.accountNumber}</div>
</div>
</div>
</WhiteBox>
Expand Down

0 comments on commit 924066b

Please sign in to comment.