mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 06:42:32 -05:00
fix download
This commit is contained in:
1 parent
5ea55c733f
commit
5d3369d556
1 file changed
+10
-1
@@ -56,7 +56,7 @@
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="!isWebView && withDownloadButton"
|
||||
v-if="(!isWebView || isNativeApp) && withDownloadButton"
|
||||
class="base-button flex items-center space-x-1 w-full completed-form-download-button"
|
||||
:disabled="isDownloading"
|
||||
@click.prevent="download"
|
||||
@@ -195,6 +195,9 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isNativeApp () {
|
||||
return !!window.webkit?.messageHandlers?.download
|
||||
},
|
||||
isWebView () {
|
||||
return /webview|wv|ip((?!.*Safari)|(?=.*like Safari))/i.test(window.navigator.userAgent)
|
||||
}
|
||||
@@ -230,6 +233,12 @@ export default {
|
||||
download () {
|
||||
this.isDownloading = true
|
||||
|
||||
if (this.isNativeApp) {
|
||||
document.addEventListener('native:download-end', () => { this.isDownloading = false }, { once: true })
|
||||
|
||||
return window.webkit.messageHandlers.download.postMessage({ src: this.baseUrl + `/s/${this.submitterSlug}/documents` })
|
||||
}
|
||||
|
||||
fetch(this.baseUrl + `/s/${this.submitterSlug}/documents`, {
|
||||
method: 'GET',
|
||||
...this.fetchOptions
|
||||
|
||||
Reference in new issue
Block a user