Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Cannot download items from Agenda in json format [STTNHUB-362] #1214

Merged
merged 6 commits into from
Dec 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions assets/wire/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,17 @@ export function submitDownloadItems(items: any, params: any) {
else{
try {
const response = await server.post(url, payload);
const blob = await response.blob();
initiateDownload(blob);
if (typeof response === 'object' && !response.blob) {
devketanpro marked this conversation as resolved.
Show resolved Hide resolved
// Assume JSON response
const blob = new Blob([JSON.stringify(response)], {type: 'application/json'});
initiateDownload(blob);
} else if (typeof response.blob === 'function') {
// Assume Blob-compatible response
const blob = await response.blob();
initiateDownload(blob);
} else {
console.error('Unexpected response type:', response);
}
} catch (error) {
console.error('Error downloading file:', error);
}
Expand Down
Loading