File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 11import { emailOTPClient , genericOAuthClient } from 'better-auth/client/plugins'
22import { createAuthClient } from 'better-auth/react'
33
4+ export function getBaseURL ( ) {
5+ let baseURL
6+
7+ if ( process . env . VERCEL_ENV === 'preview' ) {
8+ baseURL = `https://${ process . env . VERCEL_URL } `
9+ } else if ( process . env . VERCEL_ENV === 'development' ) {
10+ baseURL = `https://${ process . env . VERCEL_URL } `
11+ } else if ( process . env . VERCEL_ENV === 'production' ) {
12+ baseURL = process . env . BETTER_AUTH_URL
13+ } else if ( process . env . NODE_ENV === 'development' ) {
14+ baseURL = process . env . BETTER_AUTH_URL
15+ }
16+
17+ console . log ( 'baseURL:' , baseURL )
18+ return baseURL
19+ }
20+
421export const client = createAuthClient ( {
22+ baseURL : getBaseURL ( ) ,
523 plugins : [ genericOAuthClient ( ) , emailOTPClient ( ) ] ,
624} )
725export const { useSession } = client
You can’t perform that action at this time.
0 commit comments