Skip to content

Commit

Permalink
Merge pull request #87 from hanaro-on-and-on/Feat/#86
Browse files Browse the repository at this point in the history
feat/#86 알바생 마이페이지 내 정보 확인
  • Loading branch information
jennyjoo authored Jul 3, 2024
2 parents 701b0ce + 0101ec6 commit 15796e7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
10 changes: 10 additions & 0 deletions src/api/apiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ class ApiClient implements employeeApi {
return response.data;
}

//알바생 - 대표 계좌 조회
public async employeeGetMyInfo(): Promise<MyInfo> {
const response: BaseResponse<MyInfo> = await this.axiosInstance.request({
method: 'get',
url: 'employee/accounts',
});

return response.data;
}

//==========================
// 생성 메소드
private static createAxiosInstance() {
Expand Down
2 changes: 2 additions & 0 deletions src/api/interfaces/employeeApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ interface employeeApi {
employeeSignature(payStubId: number): Promise<EmployeeSignatureResponse>;

employeeGetAttendanceList(): Promise<EmployeeTodayAttendancesResponse>;

employeeGetMyInfo(): Promise<MyInfo>;
}

export default employeeApi;
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
7 changes: 7 additions & 0 deletions src/types/api/employee-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,10 @@ type EmployeeTodayAttendancesResponse = {
works: AttendanceTodayWork[];
totalWorks: AttendanceWork[];
};

//대표 계좌 조회 (내 정보 조회)
type MyInfo = {
accountNumber: string;
phoneNumber: string; //전화번호
username: string; //성명
};

0 comments on commit 15796e7

Please sign in to comment.