mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-29 11:15:58 +00:00
V 1.1 Beta
This commit is contained in:
+20
-6
@@ -175,18 +175,21 @@ const actions = {
|
||||
})
|
||||
})
|
||||
},
|
||||
removeItem: (context, data) => {
|
||||
removeItem: ({commit, state, getters}, data) => {
|
||||
|
||||
// Remove file
|
||||
context.commit('REMOVE_ITEM', data.unique_id)
|
||||
if (data.type === 'file') context.commit('REMOVE_ITEM_FROM_RECENT_UPLOAD', data.unique_id)
|
||||
if (data.type === 'folder') context.commit('REMOVE_ITEM_FROM_FAVOURITES', data.unique_id)
|
||||
commit('REMOVE_ITEM', data.unique_id)
|
||||
|
||||
if (data.type === 'file' || data.type === 'image')
|
||||
commit('REMOVE_ITEM_FROM_RECENT_UPLOAD', data.unique_id)
|
||||
if (data.type === 'folder')
|
||||
commit('REMOVE_ITEM_FROM_FAVOURITES', data.unique_id)
|
||||
|
||||
// Remove file preview
|
||||
context.commit('CLEAR_FILEINFO_DETAIL')
|
||||
commit('CLEAR_FILEINFO_DETAIL')
|
||||
|
||||
axios
|
||||
.post(context.getters.api + '/remove-item', {
|
||||
.post(getters.api + '/remove-item', {
|
||||
type: data.type,
|
||||
unique_id: data.unique_id,
|
||||
force_delete: data.deleted_at ? true : false
|
||||
@@ -201,6 +204,12 @@ const actions = {
|
||||
})
|
||||
},
|
||||
restoreItem: (context, item) => {
|
||||
|
||||
let restoreToHome = false
|
||||
|
||||
// Check if file can be restored to home directory
|
||||
if (context.state.currentFolder.location === 'trash' && item.type !== 'folder') restoreToHome = true
|
||||
|
||||
// Remove file
|
||||
context.commit('REMOVE_ITEM', item.unique_id)
|
||||
|
||||
@@ -211,6 +220,7 @@ const actions = {
|
||||
.post(context.getters.api + '/restore-item', {
|
||||
type: item.type,
|
||||
unique_id: item.unique_id,
|
||||
to_home: restoreToHome,
|
||||
})
|
||||
.catch(() => {
|
||||
// Show error message
|
||||
@@ -243,6 +253,10 @@ const actions = {
|
||||
.then(response => {
|
||||
context.commit('ADD_NEW_ITEMS', response.data)
|
||||
context.commit('UPDATE_RECENT_UPLOAD', response.data)
|
||||
context.commit(
|
||||
'UPLOADING_FILE_PROGRESS',
|
||||
0
|
||||
)
|
||||
resolve(response)
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
+4
-3
@@ -21,13 +21,14 @@ const actions = {
|
||||
}
|
||||
)
|
||||
},
|
||||
logOut: (context) => {
|
||||
logOut: ({getters, commit}) => {
|
||||
axios
|
||||
.get(context.getters.api + '/logout')
|
||||
.get(getters.api + '/logout')
|
||||
.then(() => {
|
||||
|
||||
// Commit Remove Access Token from vuex storage
|
||||
context.commit('DESTROY_DATA')
|
||||
commit('DESTROY_DATA')
|
||||
commit('SET_CURRENT_VIEW', 'files')
|
||||
})
|
||||
},
|
||||
addToFavourites: (context, folder_unique_id) => {
|
||||
|
||||
Reference in New Issue
Block a user