optional import in API_STRING

This commit is contained in:
waltem01 2024-04-09 09:42:10 +02:00
parent 30ea6032c9
commit c107fcff44

View File

@ -1,5 +1,7 @@
import { API_SERVER_IP, API_SERVER_PORT } from '$env/static/private';
import * as env from '$env/static/private';
export function buildAPIStr(endpoint: string) {
const API_SERVER_IP = env.API_SERVER_IP;
const API_SERVER_PORT = env.API_SERVER_PORT;
return `http://${API_SERVER_IP ?? 'localhost'}:${API_SERVER_PORT ?? '8080'}/${endpoint}`;
}