Rajiv
Fix hardcoded localhost URL in production
f26fee0
Raw
History Blame Contribute Delete
1.87 kB
import axios from "axios";
const api = axios.create({
baseURL: import.meta.env.DEV ? "http://localhost:3000" : "",
withCredentials: true,
})
/**
* @description Service to generate interview report based on user self description, resume and job description.
*/
export const generateInterviewReport = async ({ jobDescription, selfDescription, resumeFile }) => {
const formData = new FormData()
formData.append("jobDescription", jobDescription)
formData.append("selfDescription", selfDescription)
formData.append("resume", resumeFile)
const response = await api.post("/api/interview/", formData, {
headers: {
"Content-Type": "multipart/form-data"
}
})
return response.data
}
/**
* @description Service to get interview report by interviewId.
*/
export const getInterviewReportById = async (interviewId) => {
const response = await api.get(`/api/interview/report/${interviewId}`)
return response.data
}
/**
* @description Service to get all interview reports of logged in user.
*/
export const getAllInterviewReports = async () => {
const response = await api.get("/api/interview/")
return response.data
}
/**
* @description Service to generate resume pdf based on user self description, resume content and job description.
*/
export const generateResumePdf = async ({ interviewReportId, candidateAnswers = [] }) => {
const response = await api.post(`/api/interview/resume/pdf/${interviewReportId}`,
{ candidateAnswers },
{ responseType: "blob" }
)
return response.data
}
/**
* @description Service to evaluate candidate's answer for a specific question.
*/
export const evaluateAnswerAPI = async ({ question, answer }) => {
const response = await api.post("/api/interview/evaluate", { question, answer })
return response.data
}