Zeige referenzierte Paperless-Dokumente zum Ansehen und Drucken.
Deploy Development / deploy (push) Successful in 22s
Deploy Development / deploy (push) Successful in 22s
Die Datei bleibt in Paperless. Tsumugu laedt sie nur fuer die Ansicht und speichert keine Kopie. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0108a296bc
commit
871c7d3ad5
7 files changed
+167
-14
No files matched your search
@@ -67,6 +67,23 @@ export async function api(path, { method = "GET", body, form } = {}) {
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function fetchPaperless(elementId, context) {
|
||||
const params = new URLSearchParams();
|
||||
if (context?.kind && context?.id) {
|
||||
params.set("context_kind", context.kind);
|
||||
params.set("context_id", context.id);
|
||||
}
|
||||
const response = await fetch(`/api/v1/external-refs/${elementId}/content?${params}`, {
|
||||
credentials: "include",
|
||||
headers: scopeHeaders(),
|
||||
});
|
||||
if (!response.ok) {
|
||||
const data = await response.json().catch(() => null);
|
||||
throw new Error(data?.detail || "Das Paperless-Dokument ist nicht verfügbar.");
|
||||
}
|
||||
return response.blob();
|
||||
}
|
||||
|
||||
export async function downloadFile(elementId, context, filename) {
|
||||
const params = new URLSearchParams();
|
||||
if (context?.kind && context?.id) {
|
||||
|
||||
Reference in new issue
Block a user