Skip to content

Commit

Permalink
Feat: #109 프로젝트 목록 조회 API MSW 처리 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Seok93 committed Sep 5, 2024
1 parent 7df80a0 commit 9b1e1bf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/mocks/services/projectServiceHandler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { http, HttpResponse } from 'msw';
import { PROJECT_USER_DUMMY, ROLE_DUMMY, USER_DUMMY } from '@mocks/mockData';
import { PROJECT_DUMMY, PROJECT_USER_DUMMY, ROLE_DUMMY, USER_DUMMY } from '@mocks/mockData';
import type { Role } from '@/types/RoleType';
import type { User } from '@/types/UserType';

Expand Down Expand Up @@ -35,6 +35,17 @@ const projectServiceHandler = [

return HttpResponse.json(matchedUserList);
}),
// 프로젝트 목록 조회 API
http.get(`${BASE_URL}/team/:teamId/project`, ({ request, params }) => {
const accessToken = request.headers.get('Authorization');
const { teamId } = params;

if (!accessToken) return new HttpResponse(null, { status: 401 });

const projectList = PROJECT_DUMMY.filter((project) => project.teamId === Number(teamId));

return HttpResponse.json(projectList);
}),
];

export default projectServiceHandler;

0 comments on commit 9b1e1bf

Please sign in to comment.