Firebase sync

This commit is contained in:
Liyas Thomas
2020-02-24 00:30:22 +05:30
parent 010be95ed5
commit d24c572d7f
8 changed files with 164 additions and 76 deletions

View File

@@ -43,6 +43,8 @@
</template>
<script>
import { fb } from "../../functions/fb";
export default {
props: {
show: Boolean
@@ -56,6 +58,15 @@ export default {
};
},
methods: {
syncEnvironments() {
if (fb.currentUser !== null) {
if (fb.currentSettings[1].value) {
fb.writeEnvironments(
JSON.parse(JSON.stringify(this.$store.state.postwoman.environments))
);
}
}
},
addNewEnvironment() {
if (!this.$data.name) {
this.$toast.info($t("invalid_environment_name"));
@@ -69,6 +80,7 @@ export default {
];
this.$store.commit("postwoman/importAddEnvironments", newEnvironment);
this.$emit("hide-modal");
this.syncEnvironments();
},
hideModal() {
this.$emit("hide-modal");