From 20f72fbd7dc17d335c61994404bafa036e8b6f0d Mon Sep 17 00:00:00 2001 From: Paul Neubauer Date: Mon, 5 Sep 2022 09:40:15 +0200 Subject: [PATCH] Use store --- .../src/composables/upload/useUpload.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/web-runtime/src/composables/upload/useUpload.ts b/packages/web-runtime/src/composables/upload/useUpload.ts index 6232d81fb16..9e5fea46feb 100644 --- a/packages/web-runtime/src/composables/upload/useUpload.ts +++ b/packages/web-runtime/src/composables/upload/useUpload.ts @@ -14,6 +14,7 @@ import { UppyService } from '../../services/uppyService' import * as uuid from 'uuid' import { DavProperties } from 'web-pkg/src/constants' import { buildResource } from 'files/src/helpers/resources' +import { Store } from 'vuex' export interface UppyResource { id?: string @@ -107,7 +108,8 @@ export function useUpload(options: UploadOptions): UploadResult { clientService, isPublicLinkContext, publicLinkPassword, - uppyService: options.uppyService + uppyService: options.uppyService, + store }) } } @@ -116,28 +118,23 @@ const createDirectoryTree = ({ clientService, isPublicLinkContext, publicLinkPassword, - uppyService + uppyService, + store }: { clientService: ClientService isPublicLinkContext: Ref publicLinkPassword?: Ref - uppyService: UppyService + uppyService: UppyService, + store: Store }) => { return async (files: UppyResource[]) => { const { owncloudSdk: client } = clientService const createdFolders = [] - + const existingFiles = store.getters['Files/files'] for (const file of files) { const currentFolder = file.meta.currentFolder const directory = file.meta.relativeFolder - let existingFiles - if (unref(isPublicLinkContext)) { - existingFiles = await client.publicFiles.list(`${file.meta.webDavBasePath}/`, unref(publicLinkPassword), DavProperties.Default, 1) - } - existingFiles = await client.files.list(`${file.meta.webDavBasePath}/`, 1, DavProperties.Default) - existingFiles = existingFiles.map(buildResource) - if (!directory || createdFolders.includes(directory)) { continue }