diff --git a/src/app/(authentication)/layout.tsx b/src/app/(authentication)/layout.tsx
index ad0e930..8396607 100644
--- a/src/app/(authentication)/layout.tsx
+++ b/src/app/(authentication)/layout.tsx
@@ -1,16 +1,15 @@
-import React from 'react';
-import { Container } from 'react-bootstrap';
+'use client'
-export default function Layout({
- children,
-}: {
- children: React.ReactNode;
-}) {
- return (
-
-
- {children}
-
-
- )
+import React from 'react'
+import { Container } from 'react-bootstrap'
+import { SessionProvider } from 'next-auth/react'
+
+export default function Layout({ children }: { children: React.ReactNode }) {
+ return (
+
+
+ {children}{' '}
+
+
+ )
}
diff --git a/src/app/(authentication)/login/login.tsx b/src/app/(authentication)/login/login.tsx
index fb80e58..f18743c 100644
--- a/src/app/(authentication)/login/login.tsx
+++ b/src/app/(authentication)/login/login.tsx
@@ -5,10 +5,10 @@ import useDictionary from '@/locales/dictionary-hook'
import { faUser } from '@fortawesome/free-regular-svg-icons'
import { faLock } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
-import { signIn } from 'next-auth/react'
+import { signIn, useSession } from 'next-auth/react'
import Link from 'next/link'
import { useRouter } from 'next/navigation'
-import { useState } from 'react'
+import { useState, useEffect } from 'react'
import { Alert, Button, Col, Form, FormControl, InputGroup, Row } from 'react-bootstrap'
import InputGroupText from 'react-bootstrap/InputGroupText'
@@ -17,6 +17,13 @@ export default function Login({ callbackUrl }: { callbackUrl: string }) {
const [error, setError] = useState('')
const router = useRouter()
const dict = useDictionary()
+ const { data: session, status } = useSession()
+
+ useEffect(() => {
+ if (status === 'authenticated') {
+ router.push(callbackUrl)
+ }
+ }, [status, callbackUrl, router])
const login = async (formData: FormData) => {
setSubmitting(true)
diff --git a/src/app/(authentication)/login/page.tsx b/src/app/(authentication)/login/page.tsx
index 3ed25da..3a4b3b1 100644
--- a/src/app/(authentication)/login/page.tsx
+++ b/src/app/(authentication)/login/page.tsx
@@ -5,42 +5,39 @@ import Link from 'next/link'
import { Col, Row } from 'react-bootstrap'
export default async function Page({ searchParams }: { searchParams: SearchParams }) {
- const { callbackUrl } = searchParams
- const dict = await getDictionary()
+ const { callbackUrl } = searchParams
+ const dict = await getDictionary()
- const getCallbackUrl = () => {
- if (!callbackUrl) {
- return '/' // Default redirect to home page
- }
+ const getCallbackUrl = () => {
+ if (!callbackUrl) {
+ return '/' // Default redirect to home page
+ }
- return callbackUrl.toString()
- }
+ return callbackUrl.toString()
+ }
- return (
-
-
-
-
-
-
{dict.login.title}
-
{dict.login.description}
-
-
-
-
-
-
{dict.login.signup.title}
-
{dict.login.signup.description}
-
- {dict.signup.register_now}
-
-
-
+ return (
+
+
+
+
+
+
{dict.login.title}
+
{dict.login.description}
+
+
+
+
+
+
{dict.login.signup.title}
+
{dict.login.signup.description}
+
+ {dict.signup.register_now}
+
+
+
+
+
-
-
- )
+ )
}