A Vue plugin wrapper for aspnet-auth.
From npm
npm install vue-aspnet-auth --save
Import and initialize the plugin.
import { AspnetAuth } from 'vue-aspnet-auth';
Vue.use(AspnetAuth, {
url: 'http://localhost:46993',
});
Basic login example:
export default {
name: 'login',
data() {
return {
username: '',
password: '',
};
},
methods: {
login() {
this.$auth.login(this.username, this.password, (data) => {
if (data.result) {
this.$store.commit('auth', this.$auth.authentication);
this.$root.$emit('app.loggedin');
} else {
this.error = data.message;
}
});
},
},
created() {
// initialize url
this.$auth.url = `http://localhost:1234`;
},
};
Copyright © 2018 Code HQ (Pty) Ltd. This source code is licensed under the MIT license found in the LICENSE file.
Made with ♥ by Craig Pretorius