fix: remove fallback content, fix video upload and positioning
- Remove hardcoded fallback data — DB is sole content source - Sections render conditionally when data exists - Hero video slots save after each upload (not only when all 3 filled) - Video positions preserved (left/center/right) with empty string slots - Client-side 10MB hard limit on video uploads with clear error - Server-side upload error handling for body size limits - Guard Team section against empty members array - Clean up old uploaded images and videos
This commit is contained in:
+3
-4
@@ -1,11 +1,10 @@
|
||||
import { getSiteContent } from "@/lib/db";
|
||||
import { siteContent as fallback } from "@/data/content";
|
||||
import type { SiteContent } from "@/types/content";
|
||||
|
||||
let cached: { data: SiteContent; expiresAt: number } | null = null;
|
||||
const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
|
||||
|
||||
export function getContent(): SiteContent {
|
||||
export function getContent(): SiteContent | null {
|
||||
const now = Date.now();
|
||||
if (cached && now < cached.expiresAt) {
|
||||
return cached.data;
|
||||
@@ -17,9 +16,9 @@ export function getContent(): SiteContent {
|
||||
cached = { data: content, expiresAt: now + CACHE_TTL };
|
||||
return content;
|
||||
}
|
||||
return fallback;
|
||||
return null;
|
||||
} catch {
|
||||
return fallback;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user