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:
parent
f0d27bde16
commit
347c7193d0
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue