feat(ar1-admin): bottone Anteprima PDF wirato a BE /admin/ar1-templates/:id/preview-pdf
Rimosso toast 'TODO' dal bottone eye icon in Tab Template. Ora:
1. chiama Ar1Service.previewTemplatePdf(row.id) (nuovo metodo, ritorna Blob)
2. crea URL.createObjectURL + window.open('_blank')
3. revokeObjectURL dopo 60s (cleanup)
4. toast info iniziale 'Generazione anteprima...' + error toast su fail
Service: +1 metodo previewTemplatePdf(templateId) che torna Promise<Blob>
usando buildHeadersMultipart (nessun Content-Type per risposta binaria).
This commit is contained in:
@@ -210,6 +210,12 @@ const Ar1Service = {
|
||||
},
|
||||
|
||||
// ---------- ADMIN: document categories (per dropdown) ----------
|
||||
previewTemplatePdf(templateId) {
|
||||
return fetch(`${BASE_URL}/admin/ar1-templates/${templateId}/preview-pdf`, {
|
||||
method: 'POST', mode: 'cors', headers: buildHeadersMultipart()
|
||||
}).then(r => { if (!r.ok) throw new Error(`HTTP ${r.status}`); return r.blob(); });
|
||||
},
|
||||
|
||||
listDocumentCategories(onSuccess, onError) {
|
||||
fetch(`${BASE_URL}/admin/document-categories`, {
|
||||
method: 'GET', mode: 'cors', headers: buildHeaders()
|
||||
|
||||
Reference in New Issue
Block a user