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,41 +36,32 @@
</SmartModal>
</template>
<script>
import { fb } from "~/helpers/fb"
<script lang="ts">
import Vue from "vue"
import { addGraphqlCollection } from "~/newstore/collections"
export default {
export default Vue.extend({
props: {
show: Boolean,
},
data() {
return {
name: null,
name: null as string | null,
}
},
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"
)
}
}
},
addNewCollection() {
if (!this.$data.name) {
this.$toast.info(this.$t("invalid_collection_name"))
if (!this.name) {
this.$toast.info(this.$t("invalid_collection_name").toString())
return
}
this.$store.commit("postwoman/addNewCollection", {
name: this.$data.name,
flag: "graphql",
addGraphqlCollection({
name: this.name,
folders: [],
requests: [],
})
this.syncCollections()
this.hideModal()
},
hideModal() {
@@ -78,5 +69,5 @@ export default {
this.$emit("hide-modal")
},
},
}
})
</script>