fix: gracefully handle Next.js static component fetch rendering when setup configs are completely empty

This commit is contained in:
ralksta
2026-03-08 21:38:44 +01:00
parent 89bb7c0038
commit b9993bd29e
5 changed files with 19 additions and 17 deletions

View File

@@ -78,10 +78,9 @@ class ImmichClient {
return getConfig();
}
/**
* Make an authenticated request to the Immich API.
*/
private async request<T>(endpoint: string): Promise<T | null> {
if (this.config.needsSetup) return null;
const url = `${this.config.immich.apiUrl}${endpoint}`;
try {
const res = await fetch(url, {
@@ -114,6 +113,8 @@ class ImmichClient {
assetId: string,
size: ImageSize = 'preview',
): Promise<{ stream: ReadableStream; contentType: string; contentLength: string | null } | null> {
if (this.config.needsSetup || !this.config.immich.apiUrl) return null;
const endpoint =
size === 'original'
? `/assets/${encodeURIComponent(assetId)}/original`