mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-10 08:05:22 +02:00
15 lines
450 B
TypeScript
15 lines
450 B
TypeScript
|
|
import type { CreateClientConfig } from '@/client/client.gen';
|
||
|
|
|
||
|
|
export const createClientConfig: CreateClientConfig = (config) => {
|
||
|
|
// Use different URLs for server-side vs client-side
|
||
|
|
const isServer = typeof window === 'undefined';
|
||
|
|
const baseUrl = isServer
|
||
|
|
? process.env.BACKEND_URL || process.env.NEXT_PUBLIC_BACKEND_URL
|
||
|
|
: process.env.NEXT_PUBLIC_BACKEND_URL;
|
||
|
|
|
||
|
|
return {
|
||
|
|
...config,
|
||
|
|
baseUrl,
|
||
|
|
};
|
||
|
|
};
|