Skip to content

Instantly share code, notes, and snippets.

@bjensen
Created April 2, 2019 14:13
Show Gist options
  • Save bjensen/9348d82e0c1755dcad88e64206896c0d to your computer and use it in GitHub Desktop.
Save bjensen/9348d82e0c1755dcad88e64206896c0d to your computer and use it in GitHub Desktop.
import authService from "../auth/authService";
export default {
install(Vue) {
Vue.prototype.$auth = authService;
Vue.mixin({
created() {
if (this.handleLoginEvent) {
authService.addListener('loginEvent', this.handleLoginEvent);
}
},
destroyed() {
if (this.handleLoginEvent) {
authService.removeListener('loginEvent', this.handleLoginEvent);
}
}
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment