refactor getDataByLocation helper, fix moveItem popup from File info panel

This commit is contained in:
Milos Holba
2020-12-11 18:18:09 +01:00
parent 21a36c0965
commit d823ae687b
5 changed files with 28 additions and 47 deletions

View File

@@ -129,7 +129,7 @@
},
moveItem() {
// Move item fire popup
events.$emit('popup:open', {name: 'move', item: this.fileInfoDetail[0]})
events.$emit("popup:open", { name: "move", item: this.fileInfoDetail});
}
}
}

View File

@@ -308,27 +308,20 @@ const Helpers = {
return validated
}
Vue.prototype.$getDataByLocation = function() {
let folder = store.getters.currentFolder
let actions = {
'base' : ['getFolder', [{ folder: folder, back: true, init: false, sorting:true}]],
'public' : ['browseShared', [{ folder: folder, back: true, init: false, sorting:true}]],
'latest' : ['getLatest'],
'shared' : ['getShared'],
'trash-root' : ['getTrash'],
'participant_uploads' : ['getParticipantUploads'],
}
this.$store.dispatch(...actions[folder.location])
if(this.$isThisLocation('base') || this.$isThisLocation('public')){
this.$store.dispatch('getFolder', [{ folder: folder, back: true, init: false, sorting:true}])
}
if(this.$isThisLocation('latest')) {
this.$store.dispatch('getLatest')
}
if(this.$isThisLocation('shared')) {
this.$store.dispatch('getShared')
}
if(this.$isThisLocation('participant_uploads')) {
this.$store.dispatch('getParticipantUploads')
}
if(this.$isThisLocation('trash-root')) {
this.$store.dispatch('getTrash')
}
// Get dara of user with favourites tree
this.$store.dispatch('getAppData')

View File

@@ -32,7 +32,7 @@ const actions = {
events.$emit('clear-query')
}
if (! payload.back)
if (! payload.back && !payload.sorting)
commit('STORE_PREVIOUS_FOLDER', getters.currentFolder)
payload.folder.location = 'public'
@@ -43,13 +43,13 @@ const actions = {
return new Promise((resolve, reject) => {
axios
.get(route)
.get(route + getters.sorting.URI)
.then(response => {
commit('LOADING_STATE', {loading: false, data: response.data})
commit('STORE_CURRENT_FOLDER', payload.folder)
events.$emit('scrollTop')
if (payload.back)
if (payload.back && !payload.sorting)
commit('REMOVE_BROWSER_HISTORY')
resolve(response)