From 51191006184e877a13faa8383bae3b6d9bb786b0 Mon Sep 17 00:00:00 2001 From: AldemirLucas Date: Fri, 19 Jan 2024 20:53:34 -0300 Subject: [PATCH] ajust login positive --- next/middlewares/authUser.js | 3 +-- next/pages/user/login.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/next/middlewares/authUser.js b/next/middlewares/authUser.js index 892d396c..1bc3096f 100644 --- a/next/middlewares/authUser.js +++ b/next/middlewares/authUser.js @@ -22,8 +22,7 @@ async function isJWTInvalid(token) { export default async function authUser(context, destiny) { const { req, res } = context - // const invalidToken = await isJWTInvalid(req.cookies.token) - const invalidToken = true + const invalidToken = await isJWTInvalid(req.cookies.token) if (invalidToken) { cookies.remove('userBD', { path: '/' }) diff --git a/next/pages/user/login.js b/next/pages/user/login.js index 6825d0cd..7f231711 100644 --- a/next/pages/user/login.js +++ b/next/pages/user/login.js @@ -59,7 +59,7 @@ export default function Login() { } const fetchToken = async ({ email, password }) => { - const result = await getToken({email: "email", password: "password"}) + const result = await getToken({email: email, password: password}) if(result?.tokenAuth === null || result?.errors?.length > 0) return setErrors({login:"E-mail ou senha incorretos."})