From 9e42f0f1ed8b717009dc26524cb7f2aa885ac448 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 3 Jul 2017 15:57:07 +0100 Subject: [PATCH] Make reload work --- _assets/src/components/Listing.vue | 2 +- _assets/src/components/ListingItem.vue | 2 +- _assets/src/components/Main.vue | 7 ++++++- _assets/src/components/Search.vue | 2 +- _assets/src/components/prompts/DeletePrompt.vue | 4 ++-- _assets/src/components/prompts/RenamePrompt.vue | 4 +--- _assets/src/store/mutations.js | 1 + _assets/src/store/store.js | 1 + 8 files changed, 14 insertions(+), 9 deletions(-) diff --git a/_assets/src/components/Listing.vue b/_assets/src/components/Listing.vue index e37b61d7..d9cbd635 100644 --- a/_assets/src/components/Listing.vue +++ b/_assets/src/components/Listing.vue @@ -142,7 +142,7 @@ export default { Promise.all(promises) .then(() => { - // page.reload() + this.$store.commit('setReload', true) // buttons.setDone('upload') }) .catch(e => { diff --git a/_assets/src/components/ListingItem.vue b/_assets/src/components/ListingItem.vue index 68f6843c..0b01dcb5 100644 --- a/_assets/src/components/ListingItem.vue +++ b/_assets/src/components/ListingItem.vue @@ -91,7 +91,7 @@ export default { Promise.all(promises) .then(() => { - // page.reload() + this.$store.commit('setReload', true) }) .catch(error => console.log(error)) }, diff --git a/_assets/src/components/Main.vue b/_assets/src/components/Main.vue index 998881ba..86935a8a 100644 --- a/_assets/src/components/Main.vue +++ b/_assets/src/components/Main.vue @@ -136,6 +136,7 @@ export default { ...mapState([ 'req', 'user', + 'reload', 'baseURL', 'multiple', 'showInfo', @@ -167,7 +168,11 @@ export default { this.fetchData() }, watch: { - '$route': 'fetchData' + '$route': 'fetchData', + 'reload': function () { + this.$store.commit('setReload', false) + this.fetchData() + } }, mounted () { updateColumnSizes() diff --git a/_assets/src/components/Search.vue b/_assets/src/components/Search.vue index 3a7be43a..9f6bac25 100644 --- a/_assets/src/components/Search.vue +++ b/_assets/src/components/Search.vue @@ -110,7 +110,7 @@ export default { conn.onclose = (event) => { this.ongoing = false this.scrollable.scrollTop = this.scrollable.scrollHeight - // page.reload() + this.$store.commit('setReload', true) } return diff --git a/_assets/src/components/prompts/DeletePrompt.vue b/_assets/src/components/prompts/DeletePrompt.vue index dc95aecf..44397c59 100644 --- a/_assets/src/components/prompts/DeletePrompt.vue +++ b/_assets/src/components/prompts/DeletePrompt.vue @@ -54,12 +54,12 @@ export default { Promise.all(promises) .then(() => { - // page.reload() + this.$store.commit('setReload', true) // buttons.setDone('delete') }) .catch(error => { console.log(error) - // page.reload() + this.$store.commit('setReload', true) // buttons.setDone('delete', false) }) } diff --git a/_assets/src/components/prompts/RenamePrompt.vue b/_assets/src/components/prompts/RenamePrompt.vue index 19f9f78c..a172873e 100644 --- a/_assets/src/components/prompts/RenamePrompt.vue +++ b/_assets/src/components/prompts/RenamePrompt.vue @@ -61,10 +61,8 @@ export default { return } // TODO: keep selected after reload? - // page.reload() // buttons.setDone('rename') - console.log('reload') - this.$router.go({ path: this.$route.path }) + this.$store.commit('setReload', true) }).catch(error => { // buttons.setDone('rename', false) console.log(error) diff --git a/_assets/src/store/mutations.js b/_assets/src/store/mutations.js index ce786409..9bbdf092 100644 --- a/_assets/src/store/mutations.js +++ b/_assets/src/store/mutations.js @@ -17,6 +17,7 @@ const mutations = { state.showNewDir = false state.showDownload = false }, + setReload: (state, value) => (state.reload = value), setUser: (state, value) => (state.user = value), setJWT: (state, value) => (state.jwt = value), multiple: (state, value) => (state.multiple = value), diff --git a/_assets/src/store/store.js b/_assets/src/store/store.js index 2f6c24cc..82436a9e 100644 --- a/_assets/src/store/store.js +++ b/_assets/src/store/store.js @@ -11,6 +11,7 @@ const state = { baseURL: document.querySelector('meta[name="base"]').getAttribute('content'), ssl: (window.location.protocol === 'https:'), jwt: '', + reload: false, selected: [], multiple: false, showInfo: false,