Zeige E-Mail-Anlagen in der Leseansicht, damit der Inhalt nachvollziehbar bleibt.
Deploy Development / deploy (push) Successful in 29s
Deploy Development / deploy (push) Successful in 29s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
f0c8981e22
commit
2664021e7f
5 files changed
+124
-18
No files matched your search
+8
-3
@@ -76,16 +76,21 @@ function mailQuery(context) {
|
||||
return params;
|
||||
}
|
||||
|
||||
export async function downloadMailPart(elementId, context, suffix, filename) {
|
||||
export async function fetchMailPart(elementId, context, suffix) {
|
||||
const response = await fetch(`/api/v1/external-refs/${elementId}/mail/${suffix}?${mailQuery(context)}`, {
|
||||
credentials: "include",
|
||||
headers: scopeHeaders(),
|
||||
});
|
||||
if (!response.ok) {
|
||||
const data = await response.json().catch(() => null);
|
||||
throw new Error(data?.detail || "Die vollständige E-Mail ist nicht verfügbar.");
|
||||
const fallback = suffix === "original" ? "Die vollständige E-Mail ist nicht verfügbar." : "Die Anlage ist nicht verfügbar.";
|
||||
throw new Error(data?.detail || fallback);
|
||||
}
|
||||
const blob = await response.blob();
|
||||
return response.blob();
|
||||
}
|
||||
|
||||
export async function downloadMailPart(elementId, context, suffix, filename) {
|
||||
const blob = await fetchMailPart(elementId, context, suffix);
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
|
||||
Reference in new issue
Block a user