Skip to content

Commit

Permalink
fix(handler): 🐛 Fixed handler imports
Browse files Browse the repository at this point in the history
  • Loading branch information
itpropro committed Dec 27, 2023
1 parent ae51113 commit 78b989d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { genBase64FromBytes, generateRandomUrlSafeString } from './runtime/serve
import * as providerPresets from './runtime/providers'
import type { ProviderConfigs, ProviderKeys } from './runtime/types/oidc'
import type { AuthSessionConfig } from './runtime/types/session'
import { fileURLToPath } from 'url'

export interface MiddlewareConfig {
globalMiddlewareEnabled?: boolean
Expand Down Expand Up @@ -95,9 +94,6 @@ export default defineNuxtModule<ModuleOptions>({
}
}

/* const runtimeFiles = fileURLToPath(new URL('./runtime', import.meta.url))
nuxt.options.build.transpile.push(runtimeFiles) */

// App
addImportsDir(resolve('./runtime/composables'))
addPlugin(resolve('./runtime/plugins/session.server'))
Expand All @@ -107,14 +103,6 @@ export default defineNuxtModule<ModuleOptions>({
// TODO: address https://github.com/Atinux/nuxt-auth-utils/issues/1 upstream in unimport
nuxt.options.nitro.imports = defu(nuxt.options.nitro.imports, {
presets: [
{
from: resolve('./runtime/server/lib/oidc'),
imports: [
'loginEventHandler',
'callbackEventHandler',
'logoutEventHandler',
]
},
{
from: resolve('./runtime/server/utils/session'),
imports: [
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/server/handler/callback.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { callbackEventHandler } from '../lib/oidc'

export default callbackEventHandler({
async onSuccess(event, { user }) {
await setUserSession(event, user)
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/server/handler/login.get.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { loginEventHandler } from '../lib/oidc'

export default loginEventHandler({
async onSuccess(event) {
return sendRedirect(event, '/')
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/server/handler/logout.get.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { logoutEventHandler } from '../lib/oidc'

export default logoutEventHandler({
async onSuccess(event) {
return sendRedirect(event, '/')
Expand Down

0 comments on commit 78b989d

Please sign in to comment.