Commit 44c31a64 authored by Adam Procter's avatar Adam Procter

fixed data reload

parent eb1d76ea
Pipeline #169 failed with stages
in 1 minute and 22 seconds
......@@ -22,7 +22,11 @@ export default new Vuex.Store({
},
mutations: {
ADD_KNOWLEDGE_OBJECT (state, payload) {
state.allobjects.push(payload);
var ids = [];
state.allobjects.forEach(item => {ids.push(item.id)})
if (!ids.includes(payload.id)){
state.allobjects.push(payload);
}
},
LOGIN (state) {
state.pending = true;
......
......@@ -18,7 +18,7 @@ var db = new pouchdb('https://nn.adamprocter.co.uk/knowledge');
import instance from "@/components/current-instance.vue";
import logo from "@/components/instance-logo.vue";
import { mapActions } from 'vuex';
var n = 0
export default {
name: 'home',
......@@ -35,9 +35,11 @@ export default {
instancename: String
},
created() {
if (db) localdb.sync(db)
if (n == 0){
localdb.allDocs({
if (db){
localdb.sync(db)
}
localdb.allDocs({
include_docs: true,
attachments: true
}).then(result => {
......@@ -45,8 +47,7 @@ export default {
this.$store.dispatch('addKnowledgeObject', element)
})
})
n++
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment