Skip to content

Commit 26ff073

Browse files
committed
fix: dynamic imports
1 parent 90ce9b0 commit 26ff073

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/runtime/composables/useServerAuth.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { getCurrentUserFromToken } from '../server/utils/user'
2-
import { getCookie, type H3Event } from 'h3'
32
import type { ModuleOptions, UserWithoutPassword } from '../../types'
43

54
/**
@@ -21,11 +20,14 @@ import type { ModuleOptions, UserWithoutPassword } from '../../types'
2120
* ```
2221
*/
2322
export const useServerAuth = () => {
24-
const getCurrentUser = async (event: H3Event): Promise<UserWithoutPassword | null> => {
23+
const getCurrentUser = async (event: unknown): Promise<UserWithoutPassword | null> => {
2524
// This will be available at runtime when used in a Nuxt application
2625
const { useRuntimeConfig } = await import('#imports')
26+
const { getCookie } = await import('h3')
27+
2728
// Get the auth token from cookies
28-
const token = getCookie(event, 'auth_token')
29+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
30+
const token = getCookie(event as any, 'auth_token')
2931

3032
if (!token) {
3133
return null

0 commit comments

Comments
 (0)