This commit is contained in:
Shahrad Elahi 2023-09-29 08:19:55 +03:30
parent 3f9c4ea36c
commit b0663a7e15
3 changed files with 10 additions and 4 deletions

View File

@ -13,7 +13,6 @@ export default withAuth({
// See "Matching Paths" below to learn more // See "Matching Paths" below to learn more
export const config = { export const config = {
matcher: [ matcher: [
// Match all request paths except for the `/api/auth/*` paths '/((?!api/auth|login|logo.png|fonts|_next/static|_next/image|favicon.ico).*)'
'/((?!api/auth|login|fonts|_next/static|_next/image|favicon.ico).*)',
], ],
} }

View File

@ -9,7 +9,10 @@ function publicENV(ex = {}) {
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
transpilePackages: [], 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; module.exports = nextConfig;

View File

@ -3,9 +3,11 @@ import PageFooter from "@ui/pages/PageFooter";
import React from "react"; import React from "react";
import Image from "next/image"; import Image from "next/image";
import { Button, Form, Input } from "antd"; import { Button, Form, Input } from "antd";
import { useRouter } from "next/router";
export default function LoginPage() { export default function LoginPage() {
const router = useRouter()
const [ form ] = Form.useForm() const [ form ] = Form.useForm()
async function handleFinish({ password }: { password: string | undefined }) { async function handleFinish({ password }: { password: string | undefined }) {
@ -15,9 +17,11 @@ export default function LoginPage() {
await signIn( await signIn(
'credentials', 'credentials',
{ callbackUrl: '/' }, { redirect: false },
{ password } { password }
) )
await router.push('/')
} }
return ( return (