fix: viewport metadata (Next.js 15), lazy auth client init (location SSR error), force-dynamic dashboard
This commit is contained in:
+14
-4
@@ -2,8 +2,18 @@
|
||||
|
||||
import { createAuthClient } from "better-auth/react"
|
||||
|
||||
export const authClient = createAuthClient({
|
||||
baseURL: process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000",
|
||||
})
|
||||
let client: ReturnType<typeof createAuthClient> | null = null
|
||||
|
||||
export const { signIn, signUp, useSession } = authClient
|
||||
function initClient() {
|
||||
if (typeof window === "undefined") return
|
||||
if (!client) {
|
||||
client = createAuthClient({
|
||||
baseURL: process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000",
|
||||
})
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
export function getAuth() {
|
||||
return initClient()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user