export async function createExam()

in src/Frontend/src/services/exam.ts [56:72]


export async function createExam(data : any) : Promise<IExamResponse> {
    return new Promise<IExamResponse>(async (resolve, reject) => {
        try {
            await api.post(ENDPOINT_EXAMS, data).then(response => {         
                AlertInstance.alert(ALERT_SUCCESS, 'toast.success.form.exam_created');
                resolve(response.data);
            }).catch((error: any) => {
                AlertInstance.alert(ALERT_ERROR, 'error_api');
                if (process.env.NODE_ENV === 'development') console.error('API ERROR: ' + error);
                reject(null);
            });  
        } catch (e) {
            if (process.env.NODE_ENV === 'development') console.error('PROMISE ERROR: ' + e);
            reject(null);
        }
    });
}