Skip to content

Commit

Permalink
refactor: apply nuxt-auth v2.5 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
becem-gharbi committed Apr 4, 2024
1 parent d9345fa commit a6975f6
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 47 deletions.
4 changes: 1 addition & 3 deletions config/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ export const auth: Partial<ModuleOptions> = {

enableGlobalAuthMiddleware: true,

prisma: {
datasourceUrl: process.env.NUXT_AUTH_PRISMA_DATASOURCE_URL
},
prisma: false,

accessToken: {
jwtSecret: process.env.NUXT_AUTH_ACCESS_TOKEN_JWT_SECRET!
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"typecheck": "nuxi typecheck"
},
"devDependencies": {
"@bg-dev/nuxt-auth": "2.4.8",
"@bg-dev/nuxt-auth": "2.5.0",
"@bg-dev/nuxt-naiveui": "1.12.2",
"@nuxt/devtools": "^1.1.5",
"@nuxtjs/eslint-config": "^12.0.0",
Expand All @@ -26,7 +26,8 @@
"eslint": "^8.57.0",
"nuxt": "^3.11.1",
"nuxt-s3": "1.2.0",
"nuxt-security": "^1.2.2"
"nuxt-security": "^1.2.2",
"prisma": "^5.12.0"
},
"dependencies": {
"ua-parser-js": "^1.0.37"
Expand Down
75 changes: 33 additions & 42 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions server/plugins/prisma.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { PrismaClient } from '@prisma/client'

export default defineNitroPlugin((nitroApp) => {
const prisma = new PrismaClient()

nitroApp.hooks.hook('request', (event) => {
event.context.prisma = prisma
})
})

0 comments on commit a6975f6

Please sign in to comment.