Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/api/post.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import axiosInstance from './axiosInstance';

import { POST_DETAIL_URL } from '../constants/endpoint';
import {
POST_DETAIL_URL,
POST_URL,
POST_STATUS_URL,
} from '../constants/endpoint';

import type {
GetPostsParams,
CursorResponsePostDetailResponse,
GetPostDetailResponse,
RecruitmentStatusType,
} from '../types/api/posts';

// 모집글 상세조회
Expand All @@ -17,6 +23,14 @@ export const getPostDetail = async (
return data;
};

// 모집글 마감/모집 토글
export const patchPostClose = async (
postId: number,
status: RecruitmentStatusType,
): Promise<void> => {
await axiosInstance.patch(POST_STATUS_URL(postId), { status });
};

// 모집글 목록 커서 기반 조회
export const getPosts = async (
params: GetPostsParams,
Expand All @@ -37,3 +51,9 @@ export const getPosts = async (

return response.data;
};

// 모집글 작성
export const createPosts = async (postData: object) => {
const { data } = await axiosInstance.post(POST_URL, postData);
return data;
};
54 changes: 38 additions & 16 deletions src/api/team.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { TEAMS_DETAIL_URL, TEAMS_PRESIGNED_URL, TEAMS_URL, TEAMS_MEMBERS_URL, TEAMS_RECRUITMENTS_URL, MEMBER_URL } from '../constants/endpoint';
import {
TEAMS_DETAIL_URL,
TEAMS_PRESIGNED_URL,
TEAMS_URL,
TEAMS_MEMBERS_URL,
TEAMS_RECRUITMENTS_URL,
MEMBER_URL,
TEAMS_APPLICATION_URL,
} from '../constants/endpoint';
import type { TeamResponse, MemberResponse } from '../types/api/team';
import type { PostDetailResponse } from '../types/api/posts';
import axiosInstance from './axiosInstance';
Expand All @@ -19,35 +27,49 @@ export const PostTeamImage = async (contentType: string) => {

// 팀 상세 조회
export const GetTeamDetail = async (teamId: number) => {
const { data } = await axiosInstance.get<TeamResponse>(TEAMS_DETAIL_URL(teamId));
const { data } = await axiosInstance.get<TeamResponse>(
TEAMS_DETAIL_URL(teamId),
);
return data;
}
};

// 팀 지원 목록 조회
export const GetTeamApplications = async (teamId: number) => {
const { data } = await axiosInstance.get<PostDetailResponse[]>(TEAMS_RECRUITMENTS_URL(teamId));
return data;
const { data } = await axiosInstance.get<PostDetailResponse[]>(
TEAMS_APPLICATION_URL(teamId),
);
return data;
};

// 팀 모집글 목록 조회
export const GetTeamPosts = async (teamId: number) => {
const { data } = await axiosInstance.get<PostDetailResponse[]>(
TEAMS_RECRUITMENTS_URL(teamId),
);
return data;
};

// 팀 멤버 목록 조회
export const GetTeamMembers = async (teamId: number) => {
const { data } = await axiosInstance.get<MemberResponse[]>(TEAMS_MEMBERS_URL(teamId));
return data;
const { data } = await axiosInstance.get<MemberResponse[]>(
TEAMS_MEMBERS_URL(teamId),
);
return data;
};

// 팀 멤버 역할 변경
export const PatchTeamMemberRole = async (
memberId: number,
role: 'MANAGER' | 'MEMBER',
memberId: number,
role: 'MANAGER' | 'MEMBER',
) => {
const { data } = await axiosInstance.patch(MEMBER_URL(memberId), {
role,
});
return data;
const { data } = await axiosInstance.patch(MEMBER_URL(memberId), {
role,
});
return data;
};

// 팀 멤버 추방
export const DeleteTeamMember = async (memberId: number) => {
const { data } = await axiosInstance.delete(MEMBER_URL(memberId));
return data;
};
const { data } = await axiosInstance.delete(MEMBER_URL(memberId));
return data;
};
3 changes: 3 additions & 0 deletions src/assets/icons/ic_vertical_bar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions src/assets/icons/ic_waiting.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/normal/ic_close_small.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/normal/ic_close_small_thick.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading