fix(ar1-admin): TypeError Ar1Service.getTemplate is not a function

Errore runtime al click 'Modifica' sul template: avevo chiamato Ar1Service.getTemplate
ma nel service esistente il metodo si chiama getTemplateDetail. Inoltre getNextVersion
non era mai stato aggiunto al service (il mio replace precedente non ha matchato la
signature di listTemplates che include un terzo parametro queryParams).

Fix:
  - openEditTemplate ora chiama Ar1Service.getTemplateDetail (metodo esistente)
  - Aggiunto Ar1Service.getNextVersion(variant) che chiama GET /admin/ar1-templates/
    :variant/next-version (endpoint BE gia live)
This commit is contained in:
BFLOWS
2026-04-23 15:50:38 +02:00
parent ec0e7397e6
commit 3ae5aabe2d
2 changed files with 7 additions and 1 deletions

View File

@@ -297,7 +297,7 @@ const Ar1AdminConfig = () => {
setNextVersion(null);
setEditSection('layout');
Ar1Service.getTemplate(tplListRow.id,
Ar1Service.getTemplateDetail(tplListRow.id,
(tpl) => {
setEditTpl(tpl);
const lc = tpl.layout_config || {};

View File

@@ -143,6 +143,12 @@ const Ar1Service = {
}).then(r => handleResponse(r, onSuccess, onError)).catch(e => handleError(e, onError));
},
getNextVersion(variant, onSuccess, onError) {
fetch(`${BASE_URL}/admin/ar1-templates/${variant}/next-version`, {
method: 'GET', mode: 'cors', headers: buildHeaders()
}).then(r => handleResponse(r, onSuccess, onError)).catch(e => handleError(e, onError));
},
updateTemplateLayout(templateId, layoutConfig, onSuccess, onError) {
fetch(`${BASE_URL}/admin/ar1-templates/${templateId}/layout-config`, {
method: 'PUT', mode: 'cors', headers: buildHeaders(),