changement
This commit is contained in:
@@ -23,6 +23,7 @@ export async function registerApi({
|
||||
firstname,
|
||||
lastname,
|
||||
password,
|
||||
confirmPassword,
|
||||
birthdate,
|
||||
gender,
|
||||
marketingOptIn,
|
||||
@@ -38,6 +39,7 @@ export async function registerApi({
|
||||
firstname,
|
||||
lastname,
|
||||
password,
|
||||
confirmPassword,
|
||||
birthdate: birthdate || undefined,
|
||||
gender: gender || undefined,
|
||||
marketingOptIn: marketingOptIn ?? undefined,
|
||||
@@ -66,11 +68,23 @@ export async function verifyCodeApi({ email, code }) {
|
||||
return data
|
||||
}
|
||||
|
||||
export async function forgotPasswordApi(email) {
|
||||
export async function forgotPasswordApi({ email, captchaToken }) {
|
||||
const res = await fetch(`${BASE}/forgot-password`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ email }),
|
||||
body: JSON.stringify({ email, captchaToken: captchaToken || undefined }),
|
||||
})
|
||||
const data = await res.json()
|
||||
if (!res.ok) throw apiError(data.message || "Erreur lors de l'envoi du lien.", res.status)
|
||||
return data
|
||||
}
|
||||
|
||||
// Utilisateur connecté : lien envoyé à l'adresse de son compte.
|
||||
export async function sendPasswordSetupLinkApi() {
|
||||
const token = localStorage.getItem('token')
|
||||
const res = await fetch(`${BASE}/password-setup-link`, {
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
const data = await res.json()
|
||||
if (!res.ok) throw apiError(data.message || "Erreur lors de l'envoi du lien.", res.status)
|
||||
@@ -109,6 +123,21 @@ export async function deleteAccountApi() {
|
||||
return data
|
||||
}
|
||||
|
||||
export async function setInitialPasswordApi({ password, confirmPassword }) {
|
||||
const token = localStorage.getItem('token')
|
||||
const res = await fetch(`${BASE}/initial-password`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
body: JSON.stringify({ password, confirmPassword }),
|
||||
})
|
||||
const data = await res.json()
|
||||
if (!res.ok) throw apiError(data.message || "Erreur lors de l'enregistrement du mot de passe.", 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