Commit 23eccb12 authored by Adam Procter's avatar Adam Procter
Browse files

fixed initialisation of positions document

parent d35c918d
......@@ -133,11 +133,15 @@ export default {
},
mounted() {
// this.$store.dispatch('getEmoji')
// this.$store.dispatch('getPositions')
setTimeout(this.loadData, 500)
if (localStorage.nogg_name && localStorage.nogg_microcosm) {
var devicename = localStorage.nogg_name
var microcosm = localStorage.nogg_microcosm
this.$store.dispatch('setMicrocosm', { devicename, microcosm })
// this.$store.dispatch('getEmoji')
// this.$store.dispatch('getPositions')
} else {
console.log('no')
// go home
......
......@@ -80,6 +80,7 @@ export default {
mounted() {
this.$store.dispatch('getOthernodes')
this.$store.dispatch('getEmoji')
setTimeout(this.loadData, 500)
// this is to get the last letter typed if no space
// this also loads in new Emoji
......
var pouchdb
var deviceName
var docPositions
export const state = {
......@@ -63,7 +64,7 @@ export const mutations = {
})
return pouchdb
.put({
_id: state.allPos,
_id: docPositions,
_rev: doc._rev,
positions: doc.positions,
})
......@@ -112,7 +113,26 @@ export const mutations = {
.catch(function (err) {
console.log(err)
})
// ADD POSITIONS CODE HERE ONCE WORKING
pouchdb.get(docPositions).then(function (doc) {
doc.positions.push({
node_id: uniqueid,
node_x: 0,
node_y: 0,
node_width: 200,
node_height: 370,
node_zindex: 0,
node_sort: 0,
})
return pouchdb
.put({
_id: docPositions,
_rev: doc._rev,
positions: doc.positions,
})
.catch(function (err) {
console.log(err)
})
})
}
})
},
......
......@@ -27,7 +27,8 @@ export const mutations = {
state.otherNodes = []
var i
var j
console.log(state.allNodes)
// console.log(docEmoji)
// console.log(docPositions)
for (i = 0; i < Object.keys(state.allNodes).length; i++) {
if (
state.allNodes[i].id != deviceName &&
......
Supports Markdown
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