Skip to content

Commit

Permalink
download issue fix (#1334)
Browse files Browse the repository at this point in the history
download view was having an issue with downloading. the link for downloading seems to just refresh the page in a watch function instead of actually downloading the file.
  • Loading branch information
jasonchung1871 authored Apr 30, 2024
1 parent 9256c9c commit 5567f07
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/frontend/src/views/file/Download.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
import { storeToRefs } from 'pinia';
import { computed, onMounted, onUnmounted, watch } from 'vue';
import { computed, onMounted, onUnmounted } from 'vue';
import { useFormStore } from '~/store/form';
import { getDisposition } from '~/utils/transformUtils';
Expand All @@ -26,7 +26,8 @@ const isFileDownloaded = computed(
() => downloadedFile.value && downloadedFile.value.headers
);
watch(downloadedFile, () => {
async function getFile(fileId) {
await formStore.downloadFile(fileId);
if (downloadedFile.value && downloadedFile.value.headers) {
const data = downloadedFile.value.headers['content-type'].includes(
'application/json'
Expand All @@ -51,10 +52,10 @@ watch(downloadedFile, () => {
URL.revokeObjectURL(a.href);
});
}
});
}
onMounted(async () => {
await formStore.downloadFile(properties.id);
await getFile(properties.id);
});
onUnmounted(() => {
Expand Down Expand Up @@ -82,7 +83,7 @@ onUnmounted(() => {
>
<v-icon class="mb-2" size="90" icon="mdi:mdi-file-download" /><br />
If your file does not automatically download
<a href="#" :hreflang="lang" @click="formStore.downloadFile(id)">{{
<a href="#" :hreflang="lang" @click="getFile(id)">{{
$t('trans.download.downloadInfoB')
}}</a>
</div>
Expand Down

0 comments on commit 5567f07

Please sign in to comment.