Skip to content

Commit

Permalink
Merge pull request #568 from liyasthomas/fix/collection-sync
Browse files Browse the repository at this point in the history
Added create collection and save request syncs
  • Loading branch information
liyasthomas committed Feb 13, 2020
2 parents bd3e1b7 + 516610a commit 9a06b19
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions components/collections/addCollection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
</template>

<script>
import { fb } from "../../functions/fb";
export default {
props: {
show: Boolean
Expand All @@ -56,6 +58,15 @@ export default {
};
},
methods: {
syncCollections() {
if (fb.currentUser !== null) {
if (fb.currentSettings[0].value) {
fb.writeCollections(
JSON.parse(JSON.stringify(this.$store.state.postwoman.collections))
);
}
}
},
addNewCollection() {
if (!this.$data.name) {
this.$toast.info($t("invalid_collection_name"));
Expand All @@ -65,6 +76,7 @@ export default {
name: this.$data.name
});
this.$emit("hide-modal");
this.syncCollections();
},
hideModal() {
this.$emit("hide-modal");
Expand Down
12 changes: 12 additions & 0 deletions components/collections/saveRequestAs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
</template>

<script>
import { fb } from "../../functions/fb";
export default {
props: {
show: Boolean,
Expand Down Expand Up @@ -180,6 +182,15 @@ export default {
}
},
methods: {
syncCollections() {
if (fb.currentUser !== null) {
if (fb.currentSettings[0].value) {
fb.writeCollections(
JSON.parse(JSON.stringify(this.$store.state.postwoman.collections))
);
}
}
},
saveRequestAs() {
const userDidntSpecifyCollection =
this.$data.requestData.collectionIndex === undefined;
Expand All @@ -204,6 +215,7 @@ export default {
});
this.hideModal();
this.syncCollections();
},
hideModal() {
this.$emit("hide-modal");
Expand Down

0 comments on commit 9a06b19

Please sign in to comment.