Skip to content

Add bazaar export dialog#1479

Merged
Ekwav merged 5 commits intodevelopfrom
bazaar-export
Mar 11, 2026
Merged

Add bazaar export dialog#1479
Ekwav merged 5 commits intodevelopfrom
bazaar-export

Conversation

@Ekwav
Copy link
Copy Markdown
Member

@Ekwav Ekwav commented Mar 9, 2026

fixes #1477

@Ekwav Ekwav requested a review from matthias-luger March 9, 2026 13:32
Comment on lines +136 to +165
fetch(url, {
method: 'GET',
headers: {
GoogleToken: googleToken
}
})
.then(async response => {
if (!response.ok) {
const text = await response.text()
throw new Error(text || `Export failed with status ${response.status}`)
}
return response.blob()
})
.then(blob => {
const downloadUrl = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = downloadUrl
a.download = `bazaar-${props.itemTag}-export.zip`
document.body.appendChild(a)
a.click()
a.remove()
window.URL.revokeObjectURL(downloadUrl)
props.onHide()
})
.catch(err => {
alert('Export failed: ' + err.message)
})
.finally(() => {
setIsExporting(false)
})
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you fetch this manually? We now use our generated API via Tanstack Query

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated Orval API code is hardcoded to assume and parse JSON responses, this is a zip download which does not work with the generated API

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can keep it this way if it work i guess, but is the Swagger defined correctly? If it returns binary it should just return the binary string. At least thats what i would assume

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems to be a general orval limitation orval-labs/orval#869

Comment on lines +136 to +165
fetch(url, {
method: 'GET',
headers: {
GoogleToken: googleToken
}
})
.then(async response => {
if (!response.ok) {
const text = await response.text()
throw new Error(text || `Export failed with status ${response.status}`)
}
return response.blob()
})
.then(blob => {
const downloadUrl = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = downloadUrl
a.download = `bazaar-${props.itemTag}-export.zip`
document.body.appendChild(a)
a.click()
a.remove()
window.URL.revokeObjectURL(downloadUrl)
props.onHide()
})
.catch(err => {
alert('Export failed: ' + err.message)
})
.finally(() => {
setIsExporting(false)
})
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can keep it this way if it work i guess, but is the Swagger defined correctly? If it returns binary it should just return the binary string. At least thats what i would assume

@matthias-luger
Copy link
Copy Markdown
Collaborator

@Ekwav You can either take another look at the binary response or just merge it :)

@Ekwav Ekwav merged commit 08bfd97 into develop Mar 11, 2026
1 check passed
@Ekwav Ekwav deleted the bazaar-export branch March 11, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add bazaar export info page

2 participants