fix(cms): add _resolve parameter to getCalendarItems for comprehensive data retrieval
Deploy / verify (push) Successful in 38s
Deploy / deploy (push) Successful in 56s

- Updated getCalendarItems function to include the _resolve parameter set to "all", ensuring all related data is fetched.
- Refined getHref function in DeadlineBannerBlock.svelte to simplify link handling by directly checking for the url property.
This commit is contained in:
Peter Meier
2026-04-19 12:49:51 +02:00
parent da57ad1ac8
commit 5f3a60003b
2 changed files with 2 additions and 4 deletions
+1
View File
@@ -676,6 +676,7 @@ export async function getCalendarItems(
const base = getBaseUrl();
const url = new URL(`${base}/api/content/calendar_item`);
url.searchParams.set("_per_page", "1000");
url.searchParams.set("_resolve", "all");
if (options?.locale) url.searchParams.set("_locale", options.locale);
const res = await fetch(url.toString());
if (!res.ok) return [];
@@ -71,10 +71,7 @@
function getHref(link: DeadlineBannerBlockData["link"]): string {
if (typeof link === "string" && link) return link;
if (link && typeof link === "object") {
if (link.url) return link.url;
if (link._slug) return `/post/${encodeURIComponent(link._slug)}`;
}
if (link && typeof link === "object" && link.url) return link.url;
return "";
}
const href = $derived(getHref(linkValue));