mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-22 17:32:14 +00:00
- added recent uploads
- added my shared items - added trash
This commit is contained in:
47
resources/js/store/modules/fileBrowser.js
vendored
47
resources/js/store/modules/fileBrowser.js
vendored
@@ -43,16 +43,9 @@ const actions = {
|
||||
}
|
||||
})
|
||||
},
|
||||
getLatest: ({commit, getters}) => {
|
||||
getRecentUploads: ({commit, getters}) => {
|
||||
commit('LOADING_STATE', {loading: true, data: []})
|
||||
|
||||
commit('STORE_PREVIOUS_FOLDER', getters.currentFolder)
|
||||
commit('STORE_CURRENT_FOLDER', {
|
||||
name: i18n.t('sidebar.latest'),
|
||||
id: undefined,
|
||||
location: 'latest',
|
||||
})
|
||||
|
||||
axios
|
||||
.get(getters.api + '/browse/latest')
|
||||
.then(response => {
|
||||
@@ -61,45 +54,25 @@ const actions = {
|
||||
})
|
||||
.catch(() => Vue.prototype.$isSomethingWrong())
|
||||
},
|
||||
getShared: ({commit, getters}) => {
|
||||
getMySharedItems: ({commit, getters}) => {
|
||||
commit('LOADING_STATE', {loading: true, data: []})
|
||||
commit('FLUSH_FOLDER_HISTORY')
|
||||
|
||||
let currentFolder = {
|
||||
name: i18n.t('sidebar.my_shared'),
|
||||
location: 'shared',
|
||||
id: undefined,
|
||||
}
|
||||
|
||||
commit('STORE_CURRENT_FOLDER', currentFolder)
|
||||
|
||||
axios
|
||||
.get(getters.api + '/browse/share' + getters.sorting.URI)
|
||||
.then(response => {
|
||||
commit('LOADING_STATE', {loading: false, data: response.data})
|
||||
commit('STORE_PREVIOUS_FOLDER', currentFolder)
|
||||
|
||||
events.$emit('scrollTop')
|
||||
})
|
||||
.catch(() => Vue.prototype.$isSomethingWrong())
|
||||
},
|
||||
getTrash: ({commit, getters}) => {
|
||||
getTrash: ({commit, getters}, id) => {
|
||||
commit('LOADING_STATE', {loading: true, data: []})
|
||||
commit('FLUSH_FOLDER_HISTORY')
|
||||
|
||||
let trash = {
|
||||
name: i18n.t('locations.trash'),
|
||||
id: undefined,
|
||||
location: 'trash-root',
|
||||
}
|
||||
|
||||
commit('STORE_CURRENT_FOLDER', trash)
|
||||
|
||||
axios
|
||||
.get(getters.api + '/browse/trash' + getters.sorting.URI)
|
||||
.get(`${getters.api}/browse/trash/${id}/${getters.sorting.URI}`)
|
||||
.then(response => {
|
||||
commit('LOADING_STATE', {loading: false, data: response.data})
|
||||
commit('STORE_PREVIOUS_FOLDER', trash)
|
||||
|
||||
events.$emit('scrollTop')
|
||||
})
|
||||
@@ -142,20 +115,11 @@ const mutations = {
|
||||
UPDATE_FOLDER_TREE(state, tree) {
|
||||
state.navigation = tree
|
||||
},
|
||||
FLUSH_FOLDER_HISTORY(state) {
|
||||
state.browseHistory = []
|
||||
},
|
||||
FLUSH_SHARED(state, id) {
|
||||
state.entries.find(item => {
|
||||
if (item.id === id) item.shared = undefined
|
||||
})
|
||||
},
|
||||
STORE_PREVIOUS_FOLDER(state, folder) {
|
||||
state.browseHistory.push(folder)
|
||||
},
|
||||
REMOVE_BROWSER_HISTORY(state) {
|
||||
state.browseHistory.pop()
|
||||
},
|
||||
CHANGE_ITEM_NAME(state, updatedFile) {
|
||||
|
||||
// Rename filename in clipboard
|
||||
@@ -191,9 +155,6 @@ const mutations = {
|
||||
if (el.id && el.id === id) el.items++
|
||||
})
|
||||
},
|
||||
STORE_CURRENT_FOLDER(state, folder) {
|
||||
state.currentFolder = folder
|
||||
},
|
||||
REMOVE_ITEM_FROM_CLIPBOARD(state, item) {
|
||||
state.clipboard = state.clipboard.filter(element => element.id !== item.id)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user