mise a jour

This commit is contained in:
Emma781227
2026-07-08 07:10:49 +02:00
parent 68a9650223
commit 65d6b23233
12 changed files with 603 additions and 182 deletions

View File

@@ -28,6 +28,28 @@ export async function registerApi({ email, firstname, lastname, password }) {
return data
}
export async function verifyCodeApi({ email, code }) {
const res = await fetch(`${BASE}/verify-code`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, code }),
})
const data = await res.json()
if (!res.ok) throw apiError(data.message || 'Code invalide.', res.status)
return data
}
export async function deleteAccountApi() {
const token = localStorage.getItem('token')
const res = await fetch(`${BASE}/account`, {
method: 'DELETE',
headers: { Authorization: `Bearer ${token}` },
})
const data = await res.json()
if (!res.ok) throw apiError(data.message || 'Erreur lors de la suppression.', res.status)
return data
}
export async function changePasswordApi({ currentPassword, newPassword }) {
const token = localStorage.getItem('token')
const res = await fetch(`${BASE}/change-password`, {