From dc98ef8b57f66c8650ae12632d8ec186a2ca19c7 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Sun, 25 Oct 2020 21:14:59 -0400 Subject: [PATCH] Fix add folder to collections being broken when logged in (#1299) * Moved add folder modal logic out * Pass around folder paths for collections to fix folder not applying on logged in users * Remove unwanted use of folder value for addFolder store mutation Co-authored-by: Liyas Thomas --- components/collections/add-folder.vue | 17 +++++------------ components/collections/collection.vue | 3 ++- components/collections/folder.vue | 8 +++++++- components/collections/index.vue | 20 ++++++++++++++++---- store/postwoman.js | 11 +++++++++-- 5 files changed, 39 insertions(+), 20 deletions(-) diff --git a/components/collections/add-folder.vue b/components/collections/add-folder.vue index 588239074..421475efa 100644 --- a/components/collections/add-folder.vue +++ b/components/collections/add-folder.vue @@ -53,6 +53,7 @@ export default { props: { show: Boolean, folder: Object, + folderPath: String, collectionIndex: Number, }, data() { @@ -61,20 +62,12 @@ export default { } }, methods: { - syncCollections() { - if (fb.currentUser !== null) { - if (fb.currentSettings[0].value) { - fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections))) - } - } - }, addFolder() { - this.$store.commit("postwoman/addFolder", { - name: this.$data.name, - folder: this.$props.folder, + this.$emit("add-folder", { + name: this.name, + folder: this.folder, + path: this.folderPath || `${this.collectionIndex}`, }) - this.hideModal() - this.syncCollections() }, hideModal() { this.$emit("hide-modal") diff --git a/components/collections/collection.vue b/components/collections/collection.vue index b1912bd3a..6ec10f47a 100644 --- a/components/collections/collection.vue +++ b/components/collections/collection.vue @@ -32,7 +32,7 @@