ajout de la connection via facebook et du captcha

This commit is contained in:
Emma781227
2026-09-14 21:08:04 +02:00
parent 28d743deb5
commit 8a6355cde1
29 changed files with 617 additions and 153 deletions

View File

@@ -7,11 +7,11 @@ function apiError(message, status) {
return err
}
export async function loginApi({ email, password }) {
export async function loginApi({ email, password, captchaToken }) {
const res = await fetch(`${BASE}/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password }),
body: JSON.stringify({ email, password, captchaToken: captchaToken || undefined }),
})
const data = await res.json()
if (!res.ok) throw apiError(data.message || 'Erreur de connexion.', res.status)
@@ -26,6 +26,7 @@ export async function registerApi({
birthdate,
gender,
marketingOptIn,
captchaToken,
}) {
const res = await fetch(`${BASE}/register`, {
method: 'POST',
@@ -40,6 +41,7 @@ export async function registerApi({
birthdate: birthdate || undefined,
gender: gender || undefined,
marketingOptIn: marketingOptIn ?? undefined,
captchaToken: captchaToken || undefined,
}),
})
const data = await res.json()