Skip to content

Commit

Permalink
Share loader task
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Apr 14, 2022
1 parent 30f95be commit 4eee1b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class FolderLoaderPersonal implements FolderLoader {
store.commit('Files/CLEAR_CURRENT_FILES_LIST')

let resources = yield fetchResources(
ref.$client,
client,
buildWebDavFilesPath(ref.user.id, path || router.currentRoute.params.item || ''),
DavProperties.Default
)
Expand Down
39 changes: 8 additions & 31 deletions packages/web-app-files/src/services/folder/spaces/loaderShare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,20 @@ export class FolderLoaderSpacesShare implements FolderLoader {
}

public getTask(context: TaskContext): FolderLoaderTask {
const router = context.router
const store = context.store
const clientService = context.clientService

const graphClient = clientService.graphAuthenticated(
store.getters.configuration.server,
store.getters.getToken
)
const {
store,
clientService: { owncloudSdk: client }
} = context

return useTask(function* (signal1, signal2, ref, storageId, path = null) {
ref.CLEAR_CURRENT_FILES_LIST()
console.log('wololo')
const graphResponse = yield graphClient.drives.listMyDrives('', 'driveType eq mountpoint')
console.log('mountpoints', graphResponse.data)
if (!graphResponse.data) {
return
}

const webDavResponse = yield ref.$client.files.list(
buildWebDavSpacesPath(storageId, path || '')
)

let resources = []
if (!path) {
// space front page -> use space as current folder
resources.push(ref.space)
store.commit('Files/CLEAR_CURRENT_FILES_LIST')

const webDavResources = webDavResponse.map(buildResource)
webDavResources.shift() // Remove webdav entry for the space itself
resources = resources.concat(webDavResources)
} else {
resources = webDavResponse.map(buildResource)
}
const webDavResponse = yield client.files.list(buildWebDavSpacesPath(storageId, path || ''))

const resources = webDavResponse.map(buildResource)
const currentFolder = resources.shift()

ref.LOAD_FILES({
store.commit('Files/LOAD_FILES', {
currentFolder,
files: resources
})
Expand Down

0 comments on commit 4eee1b2

Please sign in to comment.