Commit 811ebdab authored by Adam Procter's avatar Adam Procter

closer

parent 36056767
Pipeline #199 failed with stages
in 1 minute and 2 seconds
This diff is collapsed.
...@@ -25,7 +25,6 @@ export default { ...@@ -25,7 +25,6 @@ export default {
email:'', email:'',
domain:'', domain:'',
permissions:1, permissions:1,
token:'',
verified:false verified:false
} }
} }
...@@ -35,7 +34,8 @@ export default { ...@@ -35,7 +34,8 @@ export default {
}, },
methods: { methods: {
registeraccount() { registeraccount() {
this.$store.dispatch('registeraccount',this.input)
this.$store.dispatch('registeraccount', this.input)
} }
} }
// var uniqueid = Math.random().toString(36).substring(2, 15) // var uniqueid = Math.random().toString(36).substring(2, 15)
......
...@@ -27,7 +27,7 @@ new Vue({ ...@@ -27,7 +27,7 @@ new Vue({
render: h => h(App) render: h => h(App)
}).$mount('#app') }).$mount('#app')
//store.dispatch("db_init"); store.dispatch("db_init")
{ {
require('@/assets/js/custom') require('@/assets/js/custom')
......
...@@ -5,8 +5,11 @@ import pouchdb from 'pouchdb' ...@@ -5,8 +5,11 @@ import pouchdb from 'pouchdb'
const accounts_db = new pouchdb('accounts'); const accounts_db = new pouchdb('accounts');
const knowledge_db = new pouchdb('knowledge'); const knowledge_db = new pouchdb('knowledge');
// server admin has to create DB first and CORS allows specific domains. // server admin has to create DB first and CORS allows specific domains.
var remote_accounts_db = new pouchdb('https://nn.adamprocter.co.uk/accounts'); //var remote_accounts_db = new pouchdb('https://nn.adamprocter.co.uk/accounts');
var remote_knowledge_db = new pouchdb('https://nn.adamprocter.co.uk/knowledge'); //var remote_knowledge_db = new pouchdb('https://nn.adamprocter.co.uk/knowledge');
pouchdb.sync('accounts','https://nn.adamprocter.co.uk/accounts' )
//pouchdb.sync('knowledge','https://nn.adamprocter.co.uk/knowledge' )
Vue.use(Vuex) Vue.use(Vuex)
...@@ -17,6 +20,7 @@ const LOGOUT = "LOGOUT"; ...@@ -17,6 +20,7 @@ const LOGOUT = "LOGOUT";
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
allobjects: [], allobjects: [],
// registeraccount:[],
database: null, database: null,
isLoggedIn: !!localStorage.getItem("token"), isLoggedIn: !!localStorage.getItem("token"),
}, },
...@@ -37,29 +41,23 @@ export default new Vuex.Store({ ...@@ -37,29 +41,23 @@ export default new Vuex.Store({
state.isLoggedIn = false; state.isLoggedIn = false;
}, },
REGISTER_ACCOUNT(data){ REGISTER_ACCOUNT(data, payload){
var uniqueid = Math.random().toString(36).substring(2, 15) var uniqueid = Math.random().toString(36).substring(2, 15)
+ Math.random().toString(36).substring(2, 15); + Math.random().toString(36).substring(2, 15);
// state.data.push({ console.log(payload)
// before : is the couch name to the right is data from component // before : is the couch name to the right is data from component
accounts_db.put accounts_db.put
({ ({
_id:uniqueid, _id:uniqueid,
name:data.name, name:payload.name,
email:data.email, email:payload.email,
domain:data.domain, domain:payload.domain,
permissions:data.permissions, permissions:payload.permissions,
token:data.token, token:payload.token,
verified:data.verified verified:payload.verified
}) })
// })
// syncData()
// syncData(){
// if (remote_accounts_db) {
// accounts_db.sync(remote_accounts_db)
// }
// }
}, },
...@@ -73,6 +71,11 @@ export default new Vuex.Store({ ...@@ -73,6 +71,11 @@ export default new Vuex.Store({
}, },
actions: { actions: {
db_init({ commit }){
commit('DB_INIT')
},
// https://www.nativescript.org/blog/data-management-with-sqlite-and-vuex-in-a-nativescript-vue-app // https://www.nativescript.org/blog/data-management-with-sqlite-and-vuex-in-a-nativescript-vue-app
// db initialisation, query, and write need to flow through vuex // db initialisation, query, and write need to flow through vuex
// db should be stored in store // db should be stored in store
...@@ -89,9 +92,9 @@ export default new Vuex.Store({ ...@@ -89,9 +92,9 @@ export default new Vuex.Store({
// }); // });
// }, // },
registeraccount({ commit }, data) { registeraccount({ commit }, payload) {
commit('REGISTER_ACCOUNT') commit('REGISTER_ACCOUNT', payload)
}, },
showKnowledgeObjects({ commit }, payload) { showKnowledgeObjects({ commit }, payload) {
......
...@@ -28,21 +28,21 @@ name: 'app', ...@@ -28,21 +28,21 @@ name: 'app',
}, },
data () { data () {
return { return {
instancename:'mozfest', instancename:'mozfest'//,
accounts: [ // accounts: [
{ // {
id:1, // id:1,
human:'adam procter', // human:'adam procter',
email:'adamprocter@researchnot.es', // email:'adamprocter@researchnot.es',
permissions: 1 // permissions: 1
}, // },
{ // {
id:2, // id:2,
human:'mathew parker', // human:'mathew parker',
email:'mathew@researchnot.es', // email:'mathew@researchnot.es',
permissions: 1 // permissions: 1
} // }
] // ]
} }
} }
} }
......
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