|
|
@ -17,7 +17,12 @@ export default function LoginApp() {
|
|
|
|
const email = emailRef.current!.value
|
|
|
|
const email = emailRef.current!.value
|
|
|
|
const password = passwordRef.current!.value
|
|
|
|
const password = passwordRef.current!.value
|
|
|
|
|
|
|
|
|
|
|
|
const response = await fetchAPI("auth/token", { email, password }, "POST", false)
|
|
|
|
const response = await fetchAPI(
|
|
|
|
|
|
|
|
"auth/token",
|
|
|
|
|
|
|
|
{ email, password },
|
|
|
|
|
|
|
|
"POST",
|
|
|
|
|
|
|
|
false,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if (response.ok) {
|
|
|
|
if (response.ok) {
|
|
|
|
const session = getSession()
|
|
|
|
const session = getSession()
|
|
|
@ -29,7 +34,14 @@ export default function LoginApp() {
|
|
|
|
|
|
|
|
|
|
|
|
// if unauthorized :
|
|
|
|
// if unauthorized :
|
|
|
|
if (response.status === 401) {
|
|
|
|
if (response.status === 401) {
|
|
|
|
setErrors([{ type: "Non autorisé", messages: ["L'adresse email ou le mot de passe sont invalide."] }])
|
|
|
|
setErrors([
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
type: "Non autorisé",
|
|
|
|
|
|
|
|
messages: [
|
|
|
|
|
|
|
|
"L'adresse email ou le mot de passe sont invalide.",
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
])
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|