Skip to content
Snippets Groups Projects
Commit 1f8c77c9 authored by Adam Procter's avatar Adam Procter
Browse files

Merge branch 'main' into futurenogg

parents cfa31622 9210e290
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@
<script>
// @ is an alias to /src
import { mapState } from 'vuex'
// import marked from 'marked'
export default {
......@@ -42,6 +43,7 @@ export default {
computed: {
...mapState({
// TODO: Can you filter here instead ?
myNodes: (state) => state.myNodes,
}),
......@@ -54,6 +56,7 @@ export default {
mounted() {
setTimeout(this.loadData, 500)
//console.log(this.microcosmName.microcosmName)
// NOT SURE THIS IS DOING ANYTHING ???
// const unwatch = this.$watch('nodesFiltered', (value) => {
// this.$options.myArray = this.nodesFiltered
......@@ -70,7 +73,6 @@ export default {
added: {
deep: true,
handler() {
console.log('add happened')
setTimeout(this.loadData, 500)
},
},
......@@ -78,10 +80,10 @@ export default {
methods: {
loadData() {
console.log('loading data')
// console.log('loading data')
this.myArray = this.nodesFiltered
console.log(this.myArray)
this.$forceUpdate()
// console.log(this.myArray)
// this.$forceUpdate()
},
editNode(e) {
......
var pouchdb
var deviceName
//var microcosmName
// var e
export const state = {
myNodes: [],
activeNode: {},
lastMicrocosm: '',
lastdeviceName: '',
}
export const mutations = {
......@@ -51,6 +55,7 @@ export const mutations = {
})
})
.catch(function (err) {
// TODO: Does this situation ever hit 404 ?
console.log(err)
if (err.status == 404) {
var uniqueid =
......@@ -75,7 +80,7 @@ export const mutations = {
}
})
},
GET_NODES() {
GET_MY_NODES() {
// console.log('called ' + deviceName)
pouchdb
.get(deviceName)
......@@ -88,9 +93,10 @@ export const mutations = {
.catch(function (err) {
console.log(err)
})
// TODO: Get other nodes from all other devices
},
// TODO: Get other nodes from all other devices
EDIT_NODE(state, e) {
var i
for (i = 0; i < Object.keys(state.myNodes).length; i++) {
......@@ -130,9 +136,8 @@ export const actions = {
commit('ADD_NODE', e)
},
getNodes: ({ commit }, e) => {
console.log('getting nodes as you added one')
commit('GET_NODES', e)
getMynodes: ({ commit }, e) => {
commit('GET_MY_NODES', e)
},
editNode: ({ commit }, { nodeid, nodetext }) => {
......@@ -140,11 +145,20 @@ export const actions = {
},
getMicrocosm(vuexContext) {
// var lastmicrocosm = localStorage.getItem('nogg_microcosm')
// pouchdb = new PouchDB(lastmicrocosm)
// deviceName = localStorage.getItem('nogg_name')
//vuexContext.dispatch('startDB', null, { root: true })
deviceName = vuexContext.rootState.setup.deviceName
// microcosmName = vuexContext.rootState.setup.microcosmName
pouchdb = vuexContext.rootState.setup.pouchdb
// if (deviceName == '') {
// vuexContext.dispatch('setMicrocosm', e, { root: true })
// } else {
// //
// this.microcosm = microcosmName
// this.deviceName = deviceName
// e = (this.devicename, this.microcosm)
// // this.pouchdb = pouchdb
// }
},
}
export const getters = {}
......@@ -74,7 +74,7 @@ export const actions = {
// }
pouchdb.replicate.from(remote).on('complete', function () {
// GET_MYNODES from myNodes.js ACTION
vuexContext.dispatch('getNodes', null, { root: true })
vuexContext.dispatch('getMynodes', null, { root: true })
pouchdb
.sync(state.remoteAddress, {
live: true,
......@@ -82,12 +82,12 @@ export const actions = {
retry: true,
})
.on('change', function () {
console.log('change happened')
vuexContext.dispatch('getNodes', null, { root: true })
// console.log('change happened')
// vuexContext.dispatch('getNodes', null, { root: true })
})
.on('paused', function () {})
.on('active', function () {
vuexContext.dispatch('getNodes', null, { root: true })
// vuexContext.dispatch('getNodes', null, { root: true })
})
.on('denied', function () {})
.on('complete', function () {})
......@@ -97,3 +97,4 @@ export const actions = {
})
},
}
export const getters = {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment