mirror of
https://github.com/KevinMidboe/immich.git
synced 2026-01-07 09:45:50 +00:00
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:
@@ -2,13 +2,15 @@
|
||||
export const prerender = false;
|
||||
|
||||
import type { Load } from '@sveltejs/kit';
|
||||
import { AlbumResponseDto, api } from '@api';
|
||||
import { AlbumResponseDto } from '@api';
|
||||
|
||||
export const load: Load = async ({ params }) => {
|
||||
export const load: Load = async ({ fetch, params }) => {
|
||||
try {
|
||||
const albumId = params['albumId'];
|
||||
|
||||
const { data: albumInfo } = await api.albumApi.getAlbumInfo(albumId);
|
||||
const albumInfo = await fetch(`/data/album/get-album-info?albumId=${albumId}`).then((r) =>
|
||||
r.json()
|
||||
);
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
<script context="module" lang="ts">
|
||||
export const prerender = false;
|
||||
|
||||
import { api } from '@api';
|
||||
import type { Load } from '@sveltejs/kit';
|
||||
|
||||
export const load: Load = async ({ params }) => {
|
||||
try {
|
||||
await api.userApi.getMyUserInfo();
|
||||
await fetch('/data/user/get-my-user-info');
|
||||
} catch (e) {
|
||||
return {
|
||||
status: 302,
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
import SideBar from '$lib/components/shared-components/side-bar/side-bar.svelte';
|
||||
import { AlbumResponseDto, api } from '@api';
|
||||
|
||||
export const load: Load = async () => {
|
||||
export const load: Load = async ({ fetch }) => {
|
||||
try {
|
||||
const { data: user } = await api.userApi.getMyUserInfo();
|
||||
const { data: albums } = await api.albumApi.getAllAlbums();
|
||||
const [user, albums] = await Promise.all([
|
||||
fetch('/data/user/get-my-user-info').then((r) => r.json()),
|
||||
fetch('/data/album/get-all-albums').then((r) => r.json())
|
||||
]);
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
|
||||
Reference in New Issue
Block a user