feat: implement attachement preview

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-08-29 16:20:52 -04:00
parent 0bfb0c6aaf
commit 59838af3db
6 changed files with 123 additions and 9 deletions
+19
View File
@@ -188,6 +188,25 @@ export function transceiveDownload<TRequest>(
return { transaction: request.transaction };
}
export async function transceiveBlob<TRequest>(operation: string, data: TRequest): Promise<Blob> {
const request: ApiRequest<TRequest> = {
version: API_VERSION,
transaction: generateTransactionId(),
operation,
data,
};
let blob: Blob | null = null;
await fetchWrapper.post(API_URL, request, {
headers: { 'Accept': '*/*' },
onStream: async (response: Response) => {
blob = await response.blob();
},
});
if (blob === null) throw new Error(`[${operation}] Empty preview response`);
return blob;
}
function appendHiddenField(form: HTMLFormElement, name: string, value: string): void {
const input = document.createElement('input');
input.type = 'hidden';