Upgrade to NextAuth v5
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
/* eslint-disable new-cap */
|
||||
import NextAuth from 'next-auth'
|
||||
import {options} from './options.js'
|
||||
import {handlers} from '../../../../auth.js'
|
||||
|
||||
const handler = NextAuth(options)
|
||||
|
||||
export {handler as GET, handler as POST}
|
||||
export const {GET, POST} = handlers
|
||||
|
||||
+4
-4
@@ -11,16 +11,16 @@ import AuthProvider from './auth-provider.js'
|
||||
export default function RootLayout({children, Session}) { // eslint-disable-line react/prop-types
|
||||
return (
|
||||
<html lang='fr'>
|
||||
<body>
|
||||
<AuthProvider session={Session}>
|
||||
<AuthProvider session={Session}>
|
||||
<body>
|
||||
<AppRouterCacheProvider>
|
||||
<ThemeProvider theme={theme}>
|
||||
<CssBaseline />
|
||||
{children}
|
||||
</ThemeProvider>
|
||||
</AppRouterCacheProvider>
|
||||
</AuthProvider>
|
||||
</body>
|
||||
</body>
|
||||
</AuthProvider>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
import {getServerSession} from 'next-auth'
|
||||
import {redirect} from 'next/navigation'
|
||||
import {auth} from '../../auth.js'
|
||||
import LoginForm from './form.js'
|
||||
|
||||
export default async function LoginPage() {
|
||||
const session = await getServerSession()
|
||||
const session = await auth()
|
||||
|
||||
if (session) {
|
||||
redirect('/')
|
||||
|
||||
+2
-3
@@ -1,9 +1,8 @@
|
||||
import {getServerSession} from 'next-auth'
|
||||
import {createDirectus, rest, readItems} from '@directus/sdk'
|
||||
import Container from '@mui/material/Container'
|
||||
import Box from '@mui/material/Box'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import {options} from './api/auth/[...nextauth]/options.js'
|
||||
import {auth} from '../auth.js'
|
||||
import Konstitisyon from '@/components/konstitisyon/index.js'
|
||||
import Footer from '@/components/footer.js'
|
||||
import Sign from '@/components/session/sign.js'
|
||||
@@ -46,7 +45,7 @@ async function getData() {
|
||||
}
|
||||
|
||||
export default async function Page() {
|
||||
const session = await getServerSession(options)
|
||||
const session = await auth()
|
||||
const {titres, articles} = await getData()
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {getServerSession} from 'next-auth'
|
||||
import {redirect} from 'next/navigation'
|
||||
import {auth} from '../../auth.js'
|
||||
import RegistrationForm from './form.js'
|
||||
|
||||
export default async function RegisterPage() {
|
||||
const session = await getServerSession()
|
||||
const session = await auth()
|
||||
|
||||
if (session) {
|
||||
redirect('/')
|
||||
|
||||
Reference in New Issue
Block a user