diff --git a/ogWebconsole/src/app/components/menus/create-menu/create-menu.component.ts b/ogWebconsole/src/app/components/menus/create-menu/create-menu.component.ts index 0095e02..3c44f9c 100644 --- a/ogWebconsole/src/app/components/menus/create-menu/create-menu.component.ts +++ b/ogWebconsole/src/app/components/menus/create-menu/create-menu.component.ts @@ -119,7 +119,7 @@ export class CreateMenuComponent implements OnInit { this.fileContent = base64Content; // Ask the backend to compile a preview using this encoded Twig - this.dataService.previewMenuTemplate(base64Content).subscribe({ + this.dataService.previewMenuTemplate(base64Content, this.baseUrl).subscribe({ next: (renderedHtml) => { const renderedBytes = new TextEncoder().encode(renderedHtml); const renderedBinaryStr = Array.from(renderedBytes).map(byte => String.fromCharCode(byte)).join(''); diff --git a/ogWebconsole/src/app/components/menus/data.service.ts b/ogWebconsole/src/app/components/menus/data.service.ts index e4aaa65..c846b22 100644 --- a/ogWebconsole/src/app/components/menus/data.service.ts +++ b/ogWebconsole/src/app/components/menus/data.service.ts @@ -29,9 +29,9 @@ export class DataService { ); } - previewMenuTemplate(base64Template: string): Observable { + previewMenuTemplate(base64Template: string, baseUrl?: string): Observable { const url = `${this.baseUrl}/menu-preview`; - return this.http.post(url, { templateBase64: base64Template }, { responseType: 'text' }).pipe( + return this.http.post(url, { templateBase64: base64Template, baseUrl: baseUrl }, { responseType: 'text' }).pipe( catchError(error => { console.error(this.translate.instant('errorPreviewingMenuTemplate'), error); return throwError(() => error);