mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-20 00:42:16 +00:00
current folder functionality
This commit is contained in:
12
resources/js/store/modules/fileBrowser.js
vendored
12
resources/js/store/modules/fileBrowser.js
vendored
@@ -21,7 +21,8 @@ const actions = {
|
||||
axios
|
||||
.get(`${getters.api}/browse/folders/${id}/${getters.sorting.URI}`)
|
||||
.then(response => {
|
||||
commit('LOADING_STATE', {loading: false, data: response.data})
|
||||
commit('LOADING_STATE', {loading: false, data: response.data.content})
|
||||
commit('SET_CURRENT_FOLDER', response.data.folder)
|
||||
|
||||
events.$emit('scrollTop')
|
||||
})
|
||||
@@ -50,6 +51,8 @@ const actions = {
|
||||
.get(getters.api + '/browse/latest')
|
||||
.then(response => {
|
||||
commit('LOADING_STATE', {loading: false, data: response.data})
|
||||
commit('SET_CURRENT_FOLDER', undefined)
|
||||
|
||||
events.$emit('scrollTop')
|
||||
})
|
||||
.catch(() => Vue.prototype.$isSomethingWrong())
|
||||
@@ -61,6 +64,7 @@ const actions = {
|
||||
.get(getters.api + '/browse/share' + getters.sorting.URI)
|
||||
.then(response => {
|
||||
commit('LOADING_STATE', {loading: false, data: response.data})
|
||||
commit('SET_CURRENT_FOLDER', undefined)
|
||||
|
||||
events.$emit('scrollTop')
|
||||
})
|
||||
@@ -72,7 +76,8 @@ const actions = {
|
||||
axios
|
||||
.get(`${getters.api}/browse/trash/${id}/${getters.sorting.URI}`)
|
||||
.then(response => {
|
||||
commit('LOADING_STATE', {loading: false, data: response.data})
|
||||
commit('LOADING_STATE', {loading: false, data: response.data.content})
|
||||
commit('SET_CURRENT_FOLDER', response.data.folder)
|
||||
|
||||
events.$emit('scrollTop')
|
||||
})
|
||||
@@ -112,6 +117,9 @@ const mutations = {
|
||||
state.entries = payload.data
|
||||
state.isLoading = payload.loading
|
||||
},
|
||||
SET_CURRENT_FOLDER(state, folder) {
|
||||
state.currentFolder = folder
|
||||
},
|
||||
UPDATE_FOLDER_TREE(state, tree) {
|
||||
state.navigation = tree
|
||||
},
|
||||
|
||||
19
resources/js/store/modules/fileFunctions.js
vendored
19
resources/js/store/modules/fileFunctions.js
vendored
@@ -7,11 +7,11 @@ import Vue from 'vue'
|
||||
|
||||
const defaultState = {
|
||||
processingPopup: undefined,
|
||||
fileQueue: [],
|
||||
filesInQueueTotal: 0,
|
||||
filesInQueueUploaded: 0,
|
||||
isProcessingFile: false,
|
||||
uploadingProgress: 0
|
||||
filesInQueueUploaded: 0,
|
||||
filesInQueueTotal: 0,
|
||||
uploadingProgress: 0,
|
||||
fileQueue: [],
|
||||
}
|
||||
|
||||
const actions = {
|
||||
@@ -84,9 +84,13 @@ const actions = {
|
||||
? `/api/editor/create-folder/${router.currentRoute.params.token}`
|
||||
: '/api/create-folder'
|
||||
|
||||
let parent_id = getters.currentFolder
|
||||
? getters.currentFolder.id
|
||||
: undefined
|
||||
|
||||
axios
|
||||
.post(route, {
|
||||
parent_id: getters.currentFolder.id,
|
||||
parent_id: parent_id,
|
||||
name: folder.name,
|
||||
icon: folder.icon
|
||||
})
|
||||
@@ -100,9 +104,10 @@ const actions = {
|
||||
events.$emit('newFolder:focus', response.data.id)
|
||||
}, 10)
|
||||
|
||||
if (getters.currentFolder.location !== 'public')
|
||||
if (! Vue.prototype.$isThisRoute(router, ['Public']))
|
||||
dispatch('getAppData')
|
||||
if (getters.currentFolder.location === 'public')
|
||||
|
||||
if (Vue.prototype.$isThisRoute(router, ['Public']))
|
||||
dispatch('getFolderTree')
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user