ajout de la connection via facebook et du captcha
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user