Remove VITE_SERVER_ENDPOINT dependency (#428)

* Move backend api to its own instance

* Remove external fetch hook

* Added endpoint for album

* Added endpoint for admin page

* Make request directly to immich-server

* Refactor unsued code
This commit is contained in:
Alex
2022-08-06 18:14:54 -05:00
committed by GitHub
parent cf2b9eddfa
commit b68358766b
23 changed files with 152 additions and 66 deletions

View File

@@ -0,0 +1,18 @@
import { AlbumResponseDto, serverApi } from '@api';
import type { RequestEvent, RequestHandlerOutput } from '@sveltejs/kit';
export const GET = async ({
url
}: RequestEvent): Promise<RequestHandlerOutput<AlbumResponseDto>> => {
try {
const albumId = url.searchParams.get('albumId') || '';
const { data } = await serverApi.albumApi.getAlbumInfo(albumId);
return {
body: data
};
} catch {
return {
status: 500
};
}
};

View File

@@ -0,0 +1,18 @@
import { AlbumResponseDto, serverApi } from '@api';
import type { RequestEvent, RequestHandler, RequestHandlerOutput } from '@sveltejs/kit';
export const GET = async ({
url
}: RequestEvent): Promise<RequestHandlerOutput<AlbumResponseDto[]>> => {
try {
const isShared = url.searchParams.get('isShared') === 'true' || undefined;
const { data } = await serverApi.albumApi.getAllAlbums(isShared);
return {
body: data
};
} catch {
return {
status: 500
};
}
};