mise a jour

This commit is contained in:
Emma781227
2026-07-01 22:06:22 +02:00
parent efd10d6754
commit 68a9650223
22 changed files with 719 additions and 167 deletions

View File

@@ -0,0 +1,31 @@
const BASE = '/api/employee'
function authHeaders() {
const token = localStorage.getItem('token')
return { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }
}
function apiError(message, status) {
const err = new Error(message)
err.status = status
return err
}
export async function searchTicketApi(code) {
const res = await fetch(`${BASE}/ticket/${encodeURIComponent(code.toUpperCase())}`, {
headers: authHeaders(),
})
const data = await res.json()
if (!res.ok) throw apiError(data.message || 'Erreur lors de la recherche.', res.status)
return data
}
export async function deliverClaimApi(claimId) {
const res = await fetch(`${BASE}/claim/${claimId}/deliver`, {
method: 'PATCH',
headers: authHeaders(),
})
const data = await res.json()
if (!res.ok) throw apiError(data.message || 'Erreur lors de la remise.', res.status)
return data
}