Skip to content
Merged
Changes from all commits
Commits
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
18 changes: 16 additions & 2 deletions src/api/applicants.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import axios from './axiosInstance';
import {
PROJECT_ME_URL,
PROJECTS_APPLICATION_URL,
PROJECTS_APPLY_URL,
PROJECTS_APPROVAL_URL,
PROJECTS_REJECT_URL,
} from '../constants/endpoint';
import axiosInstance from './axiosInstance';

export type UserProfile = {
id: string;
Expand Down Expand Up @@ -50,7 +53,6 @@ export function normalizeApplicants(payload: any): UserProfile[] {
: [];
}


export async function getApplicants(projectId: number): Promise<UserProfile[]> {
const { data } = await axios.get(PROJECTS_APPLICATION_URL(projectId));
return normalizeApplicants(data?.payload);
Expand All @@ -64,4 +66,16 @@ export async function approveApplicant(projectId: number, userId: string) {
export async function rejectApplicant(projectId: number, userId: string) {
const { data } = await axios.put(PROJECTS_REJECT_URL(projectId, userId));
return data;
}
}

export const postApply = async (projectId: number, position: string) => {
const { data } = await axiosInstance.post(PROJECTS_APPLY_URL(projectId), {
position,
});
return data.payload;
};

export const getMyApply = async (status?: string) => {
const { data } = await axiosInstance.get(PROJECT_ME_URL, { params: status });
return data.payload;
};
Loading