mirror of
https://github.com/YuzuZensai/Minikura.git
synced 2026-09-13 18:59:25 +00:00
🐛 fix: proxy requests through the web origin
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { treaty } from "@elysiajs/eden";
|
||||
import type { App } from "@minikura/backend";
|
||||
|
||||
const baseUrl = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3000";
|
||||
const baseUrl =
|
||||
typeof window === "undefined"
|
||||
? process.env.API_URL || "http://localhost:3000"
|
||||
: window.location.origin;
|
||||
|
||||
export const api = treaty<App>(baseUrl, {
|
||||
fetch: {
|
||||
|
||||
@@ -2,9 +2,11 @@ import { adminClient } from "better-auth/client/plugins";
|
||||
import { createAuthClient } from "better-auth/react";
|
||||
|
||||
export const authClient = createAuthClient({
|
||||
baseURL: process.env.NEXT_PUBLIC_API_URL || "http://localhost:3000",
|
||||
basePath: "/auth",
|
||||
plugins: [adminClient()],
|
||||
fetchOptions: {
|
||||
credentials: "include",
|
||||
},
|
||||
});
|
||||
|
||||
export const { useSession, signIn, signOut, signUp } = authClient;
|
||||
|
||||
Reference in New Issue
Block a user