From b136d7c30df40fc33888b0b23c3e9e4664465df4 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Wed, 8 Feb 2023 16:27:45 +0100 Subject: [PATCH] Support selecting multiple files in v-upload (#17394) * support multiple on selection in v-upload * run linter --- app/src/components/v-upload.vue | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/app/src/components/v-upload.vue b/app/src/components/v-upload.vue index fe35b64d88..91965ed632 100644 --- a/app/src/components/v-upload.vue +++ b/app/src/components/v-upload.vue @@ -235,12 +235,26 @@ function useSelection() { return { setSelection }; async function setSelection(selection: string[]) { - if (selection[0]) { - const id = selection[0]; - const fileResponse = await api.get(`/files/${id}`); - emit('input', fileResponse.data.data); + if (props.multiple) { + const filesResponse = await api.get(`/files`, { + params: { + filter: { + id: { + _in: selection, + }, + }, + }, + }); + + emit('input', filesResponse.data.data); } else { - emit('input', null); + if (selection[0]) { + const id = selection[0]; + const fileResponse = await api.get(`/files/${id}`); + emit('input', fileResponse.data.data); + } else { + emit('input', null); + } } } }