Skip to content
Snippets Groups Projects
Commit 79756b0c authored by Simon Malesys's avatar Simon Malesys
Browse files

Fetch pre-made archives only on dialog open

parent 1d855cd9
No related branches found
No related tags found
No related merge requests found
Pipeline #150709 failed
......@@ -63,7 +63,7 @@
</template>
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { computed, onMounted, ref, watch } from 'vue'
import api from '../api'
import { useStore } from '../store'
import AppDialog from './AppDialog.vue'
......@@ -72,9 +72,15 @@ const store = useStore()
const downloadsVisible = ref<boolean>(false)
const archives = computed(() => store.archives)
onMounted(() => {
store.fetchArchives()
})
/**
* Fetch the list of archives when the dialog is opened.
* Do it only once to avoid unnecessary requests.
*/
watch(
downloadsVisible,
() => { store.fetchArchives() },
{ once: true }
)
/**
* Open the dialog.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment