Commit 9eaae0f3 authored by Adam Procter's avatar Adam Procter 💩

updates

parent ef3736b5
......@@ -32,14 +32,12 @@ const store = new Vuex.Store({
},
actions: {
SYNC_DB() {
console.log('sync')
pouchdb.sync(remote, { live: true, retry: true })
},
CHANGES_DBSIDE() {
console.log('yo')
// call mutation when you hear DB changes
pouchdb
.changes({
since: 'now',
......@@ -82,7 +80,6 @@ const store = new Vuex.Store({
pouchdb.put({ _id: id, flavour: event })
}
})
store.dispatch('CHANGES_DBSIDE')
}
},
......
......@@ -10,6 +10,10 @@
const CLEAR_STATE = 'CLEAR_STATE'
import EntryForm from '@/components/EntryForm.vue'
import DisplayText from '@/components/DisplayText.vue'
import PouchDB from 'pouchdb'
var pouchdb = new PouchDB('icecream')
var remote = 'https://nn.adamprocter.co.uk/icecream'
export default {
name: 'entryform',
......@@ -27,15 +31,14 @@ export default {
},
//any mutations are put into the stepfwd array
created() {
this.$store.dispatch('CHANGES_DBSIDE'),
this.$store.subscribe(mutation => {
if (mutation.type !== CLEAR_STATE) {
this.stepfwd.push(mutation)
}
if (this.newMutation) {
this.stepback = []
}
})
this.$store.subscribe(mutation => {
if (mutation.type !== CLEAR_STATE) {
this.stepfwd.push(mutation)
}
if (this.newMutation) {
this.stepback = []
}
})
},
methods: {
fwd() {
......
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