Files
deckyvault/lib/eden.ts
T
adrianbonpin 18b9e5d0db fix: resolve lint issues in settings components
- Fix react-hooks/set-state-in-effect by inlining data fetch in useEffect
- Replace useCallback-wrapped fetch functions with plain async functions
- Replace window.location.href with window.location.assign()
- Remove unused eslint-disable directives
- Fix double res.json() call in passkey refresh
2026-04-26 11:31:01 -05:00

12 lines
573 B
TypeScript

import { treaty } from "@elysia/eden"
import type { App } from "@/app/api/[[...slugs]]/route"
// Use require() on the server branch to prevent the client bundler from
// pulling in Elysia and the route module. The typeof window check is the
// standard Next.js server-vs-client guard.
export const api =
typeof window === "undefined"
? // eslint-disable-next-line @typescript-eslint/no-require-imports
treaty((require("../app/api/[[...slugs]]/route") as { app: App }).app).api
: treaty<App>(process.env.NEXT_PUBLIC_SITE_URL || "http://localhost:3000").api