File size: 1,867 Bytes
3704bd1
 
 
f26fee0
3704bd1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e7c08a9
 
 
 
 
 
 
3704bd1
e7c08a9
 
 
 
 
3704bd1
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
}