vue-pouch
vue-pouch copied to clipboard
Remote server usage
Hello, can you provide example with remote server, please.. following the example throws this error
Uncaught TypeError: defaultDB.signup is not a function
at Object.createUser (eval at <anonymous> (app.js:1920), <anonymous>:58:21)
at click (eval at 204 (0.1ec1d0a….js:28), <anonymous>:28:20)
at HTMLButtonElement.invoker (eval at <anonymous> (app.js:863), <anonymous>:1734:18)
Pouch.plugin(PouchFind)
Pouch.plugin(PouchLiveFind)
Pouch.plugin(PouchAuthentication)
Vue.use(VuePouch, {
pouch: Pouch,
defaultDB: 'http://localhost:5984/boom',
defaultUsername: 'super',
defaultPassword: 'm45ter'
})
<div class="credentials">
<button v-if="$pouch.hasAuth" @click="$pouch.resetAuth()">Reset Authentication</button>
<button v-else @click="$pouch.useAuth('myname', 'mypassword')">Authenticate</button>
<button @click="$pouch.createUser('myname', 'mypassword')">Create User</button>
Your remote session name: {{ $pouch.session.name }}
<div class="error" v-if="$pouch.authError">There was an error: {{ $pouch.authError }}</div>
</div>
@nueko defaultDB needs to be a instance of PouchDB ...
Pouch.plugin(PouchFind)
Pouch.plugin(PouchLiveFind)
Pouch.plugin(PouchAuthentication)
Vue.use(VuePouch, {
pouch: Pouch,
defaultDB: new Pouch('http://localhost:5984/boom')
})
Documentation incorrectly shows:
Vue.use(require('vue-pouch'), {
pouch: PouchDB, // optional if PouchDB
is available on the global object
defaultDB: // the database to use if none is specified in the pouch setting of the vue component
})
But what about when the documentation shows:
When using VuePouch, don't use new PouchDB(...)
Just following the todo example I am getting the following error:
Nuxt.js Error:
Error: Invalid Adapter: undefined at new PouchDB$3 (C:\project\code\nodejs\dbserver\node_modules\pouchdb-browser\lib\index.js:2774:11) at VueComponent.vm.$watch.immediate (C:\project\code\nodejs\dbserver\node_modules\vue-pouch\index.js:192:42) at VueComponent.Vue.$watch (C:\project\code\nodejs\dbserver\node_modules\vue\dist\vue.runtime.common.js:3223:10) at C:\project\code\nodejs\dbserver\node_modules\vue-pouch\index.js:169:12 at Array.map (native) at VueComponent.created (C:\project\code\nodejs\dbserver\node_modules\vue-pouch\index.js:160:33)
Sorry about this. Will rewrite the documentation.