Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c95e1fe

Browse files
fix: add optional chaining for moduleOptions in serverAuth and useUserSession functions
1 parent 4801dcf commit c95e1fe

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/templates/useAuth.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function serverAuth({ options }: {
1414
}),
1515
'const betterAuthConfigs = mergeDeep({all: true})({},',
1616
'{',
17-
...options.moduleOptions.options.server
17+
...options.moduleOptions?.options?.server
1818
? Object.entries(options.moduleOptions.options.server).map(([key, value]) => {
1919
return ` ${key}: ${JSON.stringify(value)},`
2020
})

src/templates/useUserSession.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export async function useUserSession({ options }: {
2424
'',
2525
' const authClient = createAuthClient({',
2626
' baseURL: url.origin,',
27-
...options.moduleOptions.options.client
27+
...options.moduleOptions?.options?.client
2828
? Object.entries(options.moduleOptions.options.client).map(([key, value]) => {
2929
return ` ${key}: ${JSON.stringify(value)},`
3030
})

0 commit comments

Comments
 (0)