110
110
*/
111
111
112
112
import type { AuthConfig } from "@auth/core"
113
- import { Auth , isAuthAction , skipCSRFCheck , customFetch } from "@auth/core"
113
+ import {
114
+ Auth ,
115
+ isAuthAction ,
116
+ skipCSRFCheck ,
117
+ customFetch as _customFetch ,
118
+ } from "@auth/core"
114
119
import { AuthAction , Session } from "@auth/core/types"
115
120
import { implicit$FirstArg , type QRL } from "@builder.io/qwik"
116
121
import {
@@ -124,7 +129,8 @@ import { EnvGetter } from "@builder.io/qwik-city/middleware/request-handler"
124
129
import { isServer } from "@builder.io/qwik/build"
125
130
import { parseString , splitCookiesString } from "set-cookie-parser"
126
131
127
- export { customFetch }
132
+ export const customFetch = isServer ? _customFetch : undefined
133
+
128
134
export { AuthError , CredentialsSignin } from "@auth/core/errors"
129
135
130
136
export type {
@@ -149,6 +155,7 @@ export function QwikAuthQrl(
149
155
{ providerId, redirectTo : _redirectTo , options, authorizationParams } ,
150
156
req
151
157
) => {
158
+ if ( ! isServer ) return
152
159
const { redirectTo = _redirectTo ?? defaultRedirectTo ( req ) , ...rest } =
153
160
options ?? { }
154
161
@@ -192,6 +199,7 @@ export function QwikAuthQrl(
192
199
193
200
const useSignOut = globalAction$ (
194
201
async ( { redirectTo } , req ) => {
202
+ if ( ! isServer ) return
195
203
redirectTo ??= defaultRedirectTo ( req )
196
204
const authOpts = await authOptions ( req )
197
205
setEnvDefaults ( req . env , authOpts )
@@ -337,6 +345,7 @@ async function getSessionData(
337
345
}
338
346
339
347
export const setEnvDefaults = ( env : EnvGetter , config : AuthConfig ) => {
348
+ if ( ! isServer ) return
340
349
config . basePath = "/auth"
341
350
if ( ! config . secret ?. length ) {
342
351
config . secret = [ ]
0 commit comments