I use Vue Authenticate (https://github.com/dgrubelic/vue-authenticate) for VueJS 2.
I get an error when I click on login button, I can't find login in this.$auth :/
Error:
Uncaught TypeError: Cannot read property 'login' of undefined at VueComponent.login (Login.vue?9314:70) at Proxy.boundFn (vue.esm.js?efeb:187) at click (Login.vue?8b9b:195) at invoker (vue.esm.js?efeb:1937) at HTMLButtonElement.fn._withTask.fn._withTask (vue.esm.js?efeb:1772)
Code:
<v-btn color="orange darken-1" flat @click.native="login()">Login</v-btn>
JS file store.js:
methods: {
login () {
this.$auth.login(this.user).then(() => {
alert('ok')
}).catch(() => {
alert('error')
})
}
}
VueJS Instance:
new Vue({
el: '#app',
store,
router,
template: '<App/>',
components: { App }
})
Vue.use(VueAuthenticate, { ... })