feat: add api client to frontend

This commit is contained in:
EETagent 2022-12-05 20:32:20 +01:00
parent 0465b46650
commit e376149c84

View file

@ -111,6 +111,17 @@ export const apiUploadCoverLetter = async (
}
};
export const apiDeleteCoverLetter = async (): Promise<boolean> => {
try {
await axios.delete(API_URL + '/candidate/remove/cover_letter', {
withCredentials: true,
});
return true;
} catch (e) {
throw errorHandler(e, 'Failed to delete cover letter');
}
};
export const apiUploadPortfolioLetter = async (
letter: File,
progressReporter: (progress: AxiosProgressEvent) => void
@ -130,6 +141,17 @@ export const apiUploadPortfolioLetter = async (
}
};
export const apiDeletePortfolioLetter = async (): Promise<boolean> => {
try {
await axios.delete(API_URL + '/candidate/remove/portfolio_letter', {
withCredentials: true,
});
return true;
} catch (e) {
throw errorHandler(e, 'Failed to delete portfolio letter');
}
};
export const apiUploadPortfolioZip = async (
portfolio: File,
progressReporter: (progress: AxiosProgressEvent) => void
@ -149,6 +171,17 @@ export const apiUploadPortfolioZip = async (
}
};
export const apiDeletePortfolioZip = async (): Promise<boolean> => {
try {
await axios.delete(API_URL + '/candidate/remove/portfolio_zip', {
withCredentials: true,
});
return true;
} catch (e) {
throw errorHandler(e, 'Failed to delete portfolio zip');
}
};
export const apiSubmitPortfolio = async (): Promise<boolean> => {
try {
await axios.post(API_URL + '/candidate/portfolio/submit', {}, { withCredentials: true });