-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: prefer event.context instead of nitro-app
- Loading branch information
1 parent
2b17a4d
commit 57345df
Showing
5 changed files
with
13 additions
and
31 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import type { User } from '~/types/user' | ||
|
||
export default defineNitroPlugin((nitroApp) => { | ||
nitroApp.$authorization = { | ||
resolveServerUser: () => { | ||
return { id: 2, name: 'User 1' } satisfies User | ||
}, | ||
} | ||
// https://github.com/nuxt/nuxt/issues/25710#issuecomment-1935622896 | ||
nitroApp.hooks.hook('request', async (event) => { | ||
event.context.$authorization = { | ||
resolveServerUser: () => { | ||
return { id: 1, name: 'User 1' } satisfies User | ||
}, | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters