Skip to content

Commit 4ad6228

Browse files
fix: detect unset origin correctly (#68)
* fix: actually warn when origin is unset * refactor * chore: lint * Update src/module.ts
1 parent bec526f commit 4ad6228

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/module.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,9 @@ export default defineNuxtModule<ModuleOptions>({
5555
logger.info('Setting up auth...')
5656

5757
// 2. Set up runtime configuration
58-
let usedOrigin
59-
const isOriginSet = typeof moduleOptions.origin === 'undefined'
60-
if (typeof moduleOptions.origin === 'undefined') {
61-
// TODO: see if we can figure out localhost + port dynamically from the nuxt instance
62-
usedOrigin = 'http://localhost:3000'
63-
} else {
64-
usedOrigin = moduleOptions.origin
65-
}
58+
const isOriginSet = Boolean(moduleOptions.origin)
59+
// TODO: see if we can figure out localhost + port dynamically from the nuxt instance
60+
const usedOrigin = moduleOptions.origin ?? 'http://localhost:3000'
6661

6762
const options = defu(moduleOptions, {
6863
...defaults,

0 commit comments

Comments
 (0)