This commit is contained in:
root
2026-05-25 15:54:56 -04:00
parent 988d04c0a6
commit 4dde38004f
3 changed files with 11 additions and 7 deletions
+7 -5
View File
@@ -53,7 +53,8 @@ export async function postStickerGenerate(formData: FormData): Promise<Blob> {
: ''
throw new ApiHttpError(msg || `HTTP ${res.status}`, res.status, errBody)
}
return res.blob()
const raw = await res.blob()
return new Blob([await raw.arrayBuffer()], { type: 'application/pdf' })
}
export async function postBadgeGenerate(formData: FormData): Promise<Blob> {
@@ -73,7 +74,8 @@ export async function postBadgeGenerate(formData: FormData): Promise<Blob> {
: ''
throw new ApiHttpError(msg || `HTTP ${res.status}`, res.status, errBody)
}
return res.blob()
const raw = await res.blob()
return new Blob([await raw.arrayBuffer()], { type: 'application/pdf' })
}
export type StickerPreviewCounts = {
@@ -271,7 +273,7 @@ export async function openReportCardDownload(url: string): Promise<void> {
if (token) headers.set('Authorization', `Bearer ${token}`)
const res = await fetch(url, { headers })
if (!res.ok) throw new ApiHttpError(`HTTP ${res.status}`, res.status, null)
const blob = await res.blob()
const r = URL.createObjectURL(blob)
window.open(r, '_blank', 'noopener')
const raw = await res.blob()
const blob = new Blob([await raw.arrayBuffer()], { type: 'application/pdf' })
window.open(URL.createObjectURL(blob), '_blank', 'noopener')
}