From e8f2ebc2a3b8bf397702138ec88b4df9f7749b8e Mon Sep 17 00:00:00 2001 From: Erastus Amunwe Date: Mon, 26 Oct 2020 23:08:45 +0200 Subject: [PATCH] and interaction with store --- src/components/NavBar.vue | 46 ++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index df1f55e..3ae0fd1 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -29,15 +29,17 @@
@@ -71,23 +73,33 @@ export default { data: () => { return { + translation: 'Add Translation...', translations: {}, } }, computed: { savedTranslations() { - let o = {} - let counter = 0 - for(const tr in this.translations){ - if(counter>2) - break; - o = {...o, [tr]:this.translations[tr]} - counter +=1 - // Object.assign({}, o,{[tr]: this.translations[tr]}) - } - console.log(o); - return o + // let o = {} + // let counter = 0 + // for(const tr in this.translations){ + // if(counter>2) + // break; + // o = {...o, [tr]:this.translations[tr]} + // counter +=1 + // // Object.assign({}, o,{[tr]: this.translations[tr]}) + // } + // console.log(o); + return this.$store.state.settings.savedTr; + } + }, + methods: { + add(tr){ + if(!tr) return; + this.$store.dispatch('add', tr) + }, + remove(tr){ + this.$store.dispatch('remove', tr) } }, async created(){