mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-05-13 17:21:53 +00:00
Add middleware
Took 1 hour 8 minutes
This commit is contained in:
@@ -90,7 +90,7 @@ model Chat {
|
|||||||
|
|
||||||
model Message {
|
model Message {
|
||||||
id String @id @default(auto()) @map("_id") @db.ObjectId
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
||||||
message String
|
text String
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export { default } from "next-auth/middleware"
|
||||||
|
|
||||||
|
export const config = {
|
||||||
|
matcher: [
|
||||||
|
"/dashboard",
|
||||||
|
"/profile",
|
||||||
|
'/chat/:path*'
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -41,6 +41,13 @@ export default async function auth(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
return await NextAuth(req, res, {
|
return await NextAuth(req, res, {
|
||||||
providers,
|
providers,
|
||||||
session: {strategy: 'jwt'},
|
session: {strategy: 'jwt'},
|
||||||
|
pages: {
|
||||||
|
signIn: '/login',
|
||||||
|
signOut: '/auth/signout',
|
||||||
|
error: '/auth/error',
|
||||||
|
verifyRequest: '/auth/verify-request',
|
||||||
|
newUser: '/auth/new-user' // New users will be directed here on first sign in (leave the property out if not of interest)
|
||||||
|
},
|
||||||
secret: process.env.NEXTAUTH_SECRET,
|
secret: process.env.NEXTAUTH_SECRET,
|
||||||
callbacks: {
|
callbacks: {
|
||||||
async session({session, token}: { session: any; token: any }) {
|
async session({session, token}: { session: any; token: any }) {
|
||||||
|
|||||||
Reference in New Issue
Block a user