2023-06-09 18:21:18 +10:00
|
|
|
/* eslint-disable turbo/no-undeclared-env-vars */
|
2024-01-31 22:32:42 +11:00
|
|
|
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 '';
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-31 22:32:42 +11:00
|
|
|
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
|
|
|
};
|