refactor(web): combine api and serverApi (#1833)

This commit is contained in:
Michel Heusschen 2023-02-23 03:49:13 +01:00 committed by GitHub
parent 10cb612fb1
commit 5c86e13239
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 32 additions and 31 deletions

View file

@ -1,3 +1,4 @@
import { browser } from '$app/environment';
import { env } from '$env/dynamic/public';
import {
AlbumApi,
@ -56,10 +57,11 @@ class ImmichApi {
}
}
// Browser side (public) API client
export const api = new ImmichApi();
const api = new ImmichApi();
// Server side API client
export const serverApi = new ImmichApi();
const immich_server_url = env.PUBLIC_IMMICH_SERVER_URL || 'http://immich-server:3001';
serverApi.setBaseUrl(immich_server_url);
if (!browser) {
const serverUrl = env.PUBLIC_IMMICH_SERVER_URL || 'http://immich-server:3001';
api.setBaseUrl(serverUrl);
}
export { api };