mise a jour
This commit is contained in:
@@ -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`, {
|
||||
|
||||
Reference in New Issue
Block a user