fix(banners): save relative storage paths so admin preview survives refresh

Uploads were stored as host-specific URLs and a force-reload could wipe a just-saved image, leaving a broken dark-theme preview.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-26 18:01:26 +03:30
co-authored by Cursor
parent 3d63e2cf7f
commit 464995a43e
6 changed files with 142 additions and 26 deletions
+2 -2
View File
@@ -90,11 +90,11 @@ function parseSlider(raw: unknown): IBenefits[] {
return []
}
export function parseAppBanners(value: string | null | undefined): AppBannersValue {
export function parseAppBanners(value: string | Record<string, unknown> | null | undefined): AppBannersValue {
const fallback = emptyAppBanners()
if (!value) return fallback
try {
const parsed = JSON.parse(value)
const parsed = typeof value === 'string' ? JSON.parse(value) : value
if (!parsed || typeof parsed !== 'object') return fallback
// فرمت قدیمی: فقط آرایهٔ اسلایدر (header_banner)