Skip to content

Commit 1d1013e

Browse files
committed
fix: import path
1 parent 2cc5d6a commit 1d1013e

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

src/cli/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const main = defineCommand({
1212
meta: {
1313
name: 'nuxt-users',
1414
description: 'CLI for Nuxt Users Module - Manage users, migrations, and database operations',
15-
version: '1.13.0'
15+
version: '1.14.0'
1616
},
1717
subCommands: {
1818
migrate,

src/runtime/composables/useServerAuth.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { getCurrentUserFromToken } from '../server/utils/user'
2-
3-
import { useRuntimeConfig } from '#imports'
42
import { getCookie, type H3Event } from 'h3'
53
import type { ModuleOptions, UserWithoutPassword } from '../../types'
64

@@ -22,23 +20,24 @@ import type { ModuleOptions, UserWithoutPassword } from '../../types'
2220
* })
2321
* ```
2422
*/
25-
const getCurrentUser = async (event: H3Event): Promise<UserWithoutPassword | null> => {
26-
// Get the auth token from cookies
27-
const token = getCookie(event, 'auth_token')
23+
export const useServerAuth = () => {
24+
const getCurrentUser = async (event: H3Event): Promise<UserWithoutPassword | null> => {
25+
const { useRuntimeConfig } = await import('#imports')
26+
// Get the auth token from cookies
27+
const token = getCookie(event, 'auth_token')
2828

29-
if (!token) {
30-
return null
31-
}
29+
if (!token) {
30+
return null
31+
}
3232

33-
// Get the module options from runtime config
34-
const { nuxtUsers } = useRuntimeConfig()
33+
// Get the module options from runtime config
34+
const { nuxtUsers } = useRuntimeConfig()
3535

36-
// Get the current user using the token
37-
const user = await getCurrentUserFromToken(token, nuxtUsers as ModuleOptions, false)
38-
return user
39-
}
36+
// Get the current user using the token
37+
const user = await getCurrentUserFromToken(token, nuxtUsers as ModuleOptions, false)
38+
return user
39+
}
4040

41-
export const useServerAuth = () => {
4241
return {
4342
getCurrentUser
4443
}

0 commit comments

Comments
 (0)