From b0663a7e155fdc1ebf35032b8e97fb92d4253f1c Mon Sep 17 00:00:00 2001 From: Shahrad Elahi Date: Fri, 29 Sep 2023 08:19:55 +0330 Subject: [PATCH] fix --- src/middleware.ts | 3 +-- src/next.config.js | 5 ++++- src/pages/login.tsx | 6 +++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/middleware.ts b/src/middleware.ts index 6b28eff..6fdd33a 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -13,7 +13,6 @@ export default withAuth({ // See "Matching Paths" below to learn more export const config = { matcher: [ - // Match all request paths except for the `/api/auth/*` paths - '/((?!api/auth|login|fonts|_next/static|_next/image|favicon.ico).*)', + '/((?!api/auth|login|logo.png|fonts|_next/static|_next/image|favicon.ico).*)' ], } \ No newline at end of file diff --git a/src/next.config.js b/src/next.config.js index bb9c13b..c377b6c 100644 --- a/src/next.config.js +++ b/src/next.config.js @@ -9,7 +9,10 @@ function publicENV(ex = {}) { const nextConfig = { reactStrictMode: true, transpilePackages: [], - env: publicENV({ NEXTAUTH_URL: 'http://localhost:3000' }) + env: publicENV({ NEXTAUTH_URL: 'http://127.0.0.1:3000' }), + images: { + domains: [ 'img.shields.io' ] + } } module.exports = nextConfig; diff --git a/src/pages/login.tsx b/src/pages/login.tsx index ea7be25..4889007 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -3,9 +3,11 @@ import PageFooter from "@ui/pages/PageFooter"; import React from "react"; import Image from "next/image"; import { Button, Form, Input } from "antd"; +import { useRouter } from "next/router"; export default function LoginPage() { + const router = useRouter() const [ form ] = Form.useForm() async function handleFinish({ password }: { password: string | undefined }) { @@ -15,9 +17,11 @@ export default function LoginPage() { await signIn( 'credentials', - { callbackUrl: '/' }, + { redirect: false }, { password } ) + + await router.push('/') } return (