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:
@@ -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 || {};
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user