Skip to content

Commit

Permalink
feat: study member api with token
Browse files Browse the repository at this point in the history
  • Loading branch information
jasper200207 committed Jun 29, 2024
1 parent 29fa0f4 commit 66ee116
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/app/api/study.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,36 @@ const patchStudyStatus = (studyId: number, status: string) =>
method: 'PATCH',
});

const postStudyMember = (studyId: number, userId: number) =>
const postStudyMember = (token: string, studyId: number, userId: number) =>
studyFetcher(`/studies/${studyId}/members/${userId}`, {
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
},
});

const deleteStudyMember = (studyId: number, userId: number) =>
const deleteStudyMember = (token: string, studyId: number, userId: number) =>
studyFetcher(`/studies/${studyId}/members/${userId}`, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${token}`,
},
});

const leaveStudy = (studyId: number) =>
const leaveStudy = (token: string, studyId: number) =>
studyFetcher(`/studies/${studyId}/members`, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${token}`,
},
});

const getStudyMembers = (studyId: number) => studyFetcher(`/studies/${studyId}/members`);
const getStudyMembers = (token: string, studyId: number) =>
studyFetcher(`/studies/${studyId}/members`, {
headers: {
Authorization: `Bearer ${token}`,
},
});

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const getCurriculum = (studyId: number): { curriculumItems: Curriculum[] } => {
Expand Down

0 comments on commit 66ee116

Please sign in to comment.