fix: rcal API base URL — match /rcal path and fall back to space attribute

The regex matched /cal instead of /rcal, so getApiBase() always returned
empty string, causing 404s on api/events, api/lunar, and api/sources.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-02 13:27:49 -08:00
parent f0d27bde16
commit 347c7193d0
1 changed files with 6 additions and 2 deletions

View File

@ -348,8 +348,12 @@ class FolkCalendarView extends HTMLElement {
// ── API ──
private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/cal/);
return match ? `/${match[1]}/cal` : "";
// When on the rcal page directly, extract from URL
const match = window.location.pathname.match(/^\/([^/]+)\/rcal/);
if (match) return `/${match[1]}/rcal`;
// When embedded as a canvas shape, use the space attribute
if (this.space) return `/${this.space}/rcal`;
return "";
}
private async loadMonth() {