expanded log activity

This commit is contained in:
tom.hempel
2026-06-01 22:46:48 +02:00
parent da394c5525
commit e5ac069dc4
6 changed files with 62 additions and 41 deletions

View File

@ -1,4 +1,4 @@
import { apiGet } from '../api.js';
import { apiGet, apiDownloadFetch } from '../api.js';
import { canEdit, pageHeaderHTML, showToast } from '../app.js';
let questionnairesList = [];
let filterSearch = '';
@ -153,10 +153,7 @@ function wireExportActions() {
const prev = btn.textContent;
btn.textContent = 'Preparing…';
try {
const token = localStorage.getItem('qdb_token');
const res = await fetch('../api/export?bundle=1', {
headers: { Authorization: `Bearer ${token}` },
});
const res = await apiDownloadFetch('../api/export?bundle=1');
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(err.error?.message || err.error || 'Export failed');
@ -180,10 +177,7 @@ function wireExportActions() {
}
async function downloadExportCsv(btn, url, filename) {
const token = localStorage.getItem('qdb_token');
const res = await fetch(url, {
headers: { Authorization: `Bearer ${token}` },
});
const res = await apiDownloadFetch(url);
if (!res.ok) {
const err = await res.json().catch(() => ({ error: 'Download failed' }));
throw new Error(err.error?.message || err.error || 'Download failed');