diff --git a/frontend/libs/api/src/lib/config/StorytellerApiHostStore.ts b/frontend/libs/api/src/lib/config/StorytellerApiHostStore.ts index fe62be5e65..c51cd74126 100644 --- a/frontend/libs/api/src/lib/config/StorytellerApiHostStore.ts +++ b/frontend/libs/api/src/lib/config/StorytellerApiHostStore.ts @@ -39,6 +39,12 @@ export class StorytellerApiHostStore { return instance; } + /** Convert an API path to a full URL using the configured scheme and host. */ + public pathToFullUrl(path: string): string { + const trimmedPath = path.startsWith("/") ? path.slice(1) : path; + return `${this.apiSchemeAndHost}/${trimmedPath}`; + } + /** Get the API scheme and host. */ public getApiSchemeAndHost(): string { console.debug("StorytellerApiHostStore.getApiSchemeAndHost()", this.apiSchemeAndHost, this.constructor.name);