X-Git-Url: https://git.r.bdr.sh/rbdr/dasein/blobdiff_plain/7eb26514c478cfa06a797e9d63a29ef6a6d16d59..a3f9e2603dfdf8c492ec0dc355cd434fc6100f06:/app/components/welcome.js?ds=sidebyside diff --git a/app/components/welcome.js b/app/components/welcome.js new file mode 100644 index 0000000..4fcee0f --- /dev/null +++ b/app/components/welcome.js @@ -0,0 +1,39 @@ +import Vue from 'vue'; +import AuthService from '../services/auth'; + +/* global window */ + +const internals = {}; + +export default internals.WelcomeComponent = Vue.component('welcome', { + template: '
' + + '

{{message}}

' + + 'Login' + + '
', + + data() { + + return { + message: 'Welcome to Dasein, a social network with posts that disappear when the conversation stops', + loggingIn: false, + authService: new AuthService() + }; + }, + + methods: { + initiateLogin() { + + this.message = 'Logging you in...'; + this.loggingIn = true; + + this.authService.initiateLogin().then((authData) => { + + window.location.href = authData.loginUrl; + }).catch((err) => { + + console.error(err); + this.message = 'Oh no! There was a problem logging you in.'; + }); + } + } +});