Files
sign/packages/lib/universal/get-base-url.ts

18 lines
387 B
TypeScript
Raw Normal View History

2023-06-09 18:21:18 +10:00
/* eslint-disable turbo/no-undeclared-env-vars */
import { NEXT_PUBLIC_WEBAPP_URL } from '../constants/app';
2025-01-02 15:33:37 +11:00
import { env } from '../utils/env';
2024-01-25 10:48:20 +02:00
2023-06-09 18:21:18 +10:00
export const getBaseUrl = () => {
if (typeof window !== 'undefined') {
return '';
}
const webAppUrl = NEXT_PUBLIC_WEBAPP_URL();
if (webAppUrl) {
return webAppUrl;
2023-06-09 18:21:18 +10:00
}
2025-01-02 15:33:37 +11:00
return `http://localhost:${env('PORT') ?? 3000}`;
2023-06-09 18:21:18 +10:00
};