Adeen
Fix SpaCy model download and production API path
a087ed4
raw
history blame contribute delete
821 Bytes
/**
* api.js
* Handles all communication with the FastAPI backend.
*/
const API_BASE = import.meta.env.VITE_API_URL ||
(import.meta.env.PROD ? '/api' : 'http://localhost:8000/api');
/**
* Sends resume files and job details to the backend for screening.
* @param {FormData} formData - All form fields + files
* @returns {Promise<Object>} Ranked candidate results
*/
export async function analyzeResumes(formData) {
const response = await fetch(`${API_BASE}/analyze`, {
method: 'POST',
body: formData,
// Do NOT set Content-Type – the browser sets it with the boundary for multipart
});
if (!response.ok) {
const errData = await response.json().catch(() => ({}));
throw new Error(errData.detail || `Server error: ${response.status}`);
}
return response.json();
}