fix(menu): pass baseUrl to backend for accurate base tag injection

main
Juan Manuel Bardallo 2026-09-17 14:55:24 +02:00
parent 205af45b72
commit 0860b3866b
2 changed files with 3 additions and 3 deletions

View File

@ -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('');

View File

@ -29,9 +29,9 @@ export class DataService {
);
}
previewMenuTemplate(base64Template: string): Observable<string> {
previewMenuTemplate(base64Template: string, baseUrl?: string): Observable<string> {
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);