fix(storefront+TPV): storefront live search proxy, product expiry/weight display, TPV receipt popup timestamp

This commit is contained in:
chattie
2026-08-24 22:11:04 +02:00
parent 2ed2ac8cd1
commit 71165911ab
6 changed files with 79 additions and 11 deletions

View File

@@ -53,6 +53,8 @@ export interface ProductSummaryDto {
seoDescription: string | null;
categoryIds: string[];
brandId: string | null;
expirationDate?: string | null;
unitWeightKg?: number | null;
createdAt: string;
updatedAt: string;
}
@@ -79,7 +81,11 @@ export interface SearchProductsInput {
// Use env var if set, otherwise use relative URL (works for SSR and client-side via same-origin)
function apiBaseUrl(): string {
const base = process.env.API_BASE_URL ?? process.env.NEXT_PUBLIC_API_BASE_URL ?? '';
// Browser: use same-origin proxy to avoid network/IP issues
// SSR: use backend URL directly
const base = (typeof window !== 'undefined')
? '/api/catalog-proxy'
: (process.env.API_BASE_URL ?? process.env.NEXT_PUBLIC_API_BASE_URL ?? 'http://127.0.0.1:3000');
return base.replace(/\/$/, '');
}