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 <liyascthomas@gmail.com>
This commit is contained in:
Andrew Bastin
2020-10-25 21:14:59 -04:00
committed by GitHub
parent f9ae242792
commit dc98ef8b57
5 changed files with 39 additions and 20 deletions

View File

@@ -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")