mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-25 02:10:39 +00:00
api resource refactoring part 3
This commit is contained in:
@@ -161,7 +161,7 @@ export default {
|
||||
events.$emit('mobile-context-menu:show', this.item)
|
||||
},
|
||||
dragEnter() {
|
||||
if (this.item.type !== 'folder') return
|
||||
if (this.item.data.type !== 'folder') return
|
||||
|
||||
this.area = true
|
||||
},
|
||||
@@ -226,7 +226,7 @@ export default {
|
||||
this.$router.push({name: 'Public', params: {token: this.$route.params.token, id: this.item.data.id}})
|
||||
} else if (route === 'Trash') {
|
||||
this.$router.push({name: 'Trash', params: {id: this.item.data.id}})
|
||||
} else if (route === 'Files') {
|
||||
} else if (['Files', 'MySharedItems'].includes(route)) {
|
||||
this.$router.push({name: 'Files', params: {id: this.item.data.id}})
|
||||
} else if (route === 'TeamFolders') {
|
||||
this.$router.push({name: 'TeamFolders', params: {id: this.item.data.id}})
|
||||
@@ -269,7 +269,7 @@ export default {
|
||||
this.$router.push({name: 'Public', params: {token: this.$route.params.token, id: this.item.data.id}})
|
||||
} else if (route === 'Trash') {
|
||||
this.$router.push({name: 'Trash', params: {id: this.item.data.id}})
|
||||
} else if (route === 'Files') {
|
||||
} else if (['Files', 'MySharedItems'].includes(route)) {
|
||||
this.$router.push({name: 'Files', params: {id: this.item.data.id}})
|
||||
} else if (route === 'TeamFolders') {
|
||||
this.$router.push({name: 'TeamFolders', params: {id: this.item.data.id}})
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
},
|
||||
computed: {
|
||||
isDeleted() {
|
||||
return this.item.data.attributes.deleted_at ? true : false
|
||||
return this.item.data.attributes.deleted_at
|
||||
},
|
||||
emoji() {
|
||||
// Return emoji if is changed from rename popup
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<div v-if="isEmptyQuery" class="spotlight-results">
|
||||
|
||||
<!--Show results-->
|
||||
<div v-if="results.length !== 0" v-for="(item, i) in results" :key="item.id" class="result-item">
|
||||
<div v-if="results.length !== 0" v-for="(item, i) in results" :key="item.data.id" class="result-item">
|
||||
<FileItemList
|
||||
:item="item"
|
||||
class="file-item"
|
||||
@@ -105,17 +105,17 @@ export default {
|
||||
let file = this.results[this.index]
|
||||
|
||||
// Show folder
|
||||
if (file.type === 'folder') {
|
||||
this.$router.push({name: 'Files', params: {id: this.results[this.index].id}})
|
||||
if (file.data.type === 'folder') {
|
||||
this.$router.push({name: 'Files', params: {id: this.results[this.index].data.id}})
|
||||
} else {
|
||||
|
||||
// Show file
|
||||
if (['video', 'audio', 'image'].includes(file.type) || file.mimetype === 'pdf'){
|
||||
if (['video', 'audio', 'image'].includes(file.data.type) || file.data.attributes.mimetype === 'pdf'){
|
||||
this.$store.commit('ADD_TO_FAST_PREVIEW', this.results[this.index])
|
||||
|
||||
events.$emit('file-preview:show')
|
||||
} else {
|
||||
this.$downloadFile(file.file_url, file.name + '.' + file.mimetype)
|
||||
this.$downloadFile(file.data.attributes.file_url, file.data.attributes.name + '.' + file.data.attributes.mimetype)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ export default {
|
||||
let route = undefined
|
||||
|
||||
if (this.$store.getters.sharedDetail) {
|
||||
let permission = this.$store.getters.sharedDetail.is_protected
|
||||
let permission = this.$store.getters.sharedDetail.data.attributes.protected
|
||||
? 'private'
|
||||
: 'public'
|
||||
|
||||
@@ -153,7 +153,13 @@ export default {
|
||||
params: {query: value}
|
||||
})
|
||||
.then(response => {
|
||||
this.results = response.data
|
||||
|
||||
let files = response.data.files.data
|
||||
let folders = response.data.folders.data
|
||||
|
||||
console.log(files);
|
||||
|
||||
this.results = folders.concat(files)
|
||||
})
|
||||
.catch(() => this.$isSomethingWrong())
|
||||
.finally(() => this.isLoading = false)
|
||||
|
||||
Reference in New Issue
Block a user