Initial Collection State System implementation

Co-authored-by: Liyas Thomas <hi@liyasthomas.com>
This commit is contained in:
Andrew Bastin
2021-05-27 23:22:17 -04:00
parent ac1937f9be
commit eda8c7da41
22 changed files with 872 additions and 487 deletions

View File

@@ -36,15 +36,15 @@
</SmartModal>
</template>
<script>
import { fb } from "~/helpers/fb"
<script lang="ts">
import Vue from "vue"
import { editGraphqlFolder } from "~/newstore/collections"
export default {
export default Vue.extend({
props: {
show: Boolean,
collectionIndex: { type: Number, default: null },
folder: { type: Object, default: () => {} },
folderIndex: { type: Number, default: null },
folderPath: { type: String, default: null },
},
data() {
return {
@@ -52,27 +52,8 @@ export default {
}
},
methods: {
syncCollections() {
if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(
JSON.parse(
JSON.stringify(this.$store.state.postwoman.collectionsGraphql)
),
"collectionsGraphql"
)
}
}
},
editFolder() {
this.$store.commit("postwoman/editFolder", {
collectionIndex: this.$props.collectionIndex,
folder: { ...this.$props.folder, name: this.$data.name },
folderIndex: this.$props.folderIndex,
folderName: this.$props.folder.name,
flag: "graphql",
})
this.syncCollections()
editGraphqlFolder(this.folderPath, { ...this.folder, name: this.name })
this.hideModal()
},
hideModal() {
@@ -80,5 +61,5 @@ export default {
this.$emit("hide-modal")
},
},
}
})
</script>