blob: 4fcee0fe371971ff8d10b44b9aec14ed08ca3d90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
import Vue from 'vue';
import AuthService from '../services/auth';
/* global window */
const internals = {};
export default internals.WelcomeComponent = Vue.component('welcome', {
template: '<div class="welcome-container">' +
'<p>{{message}}</p>' +
'<a href="#" v-on:click=initiateLogin v-if=!loggingIn>Login</a>' +
'</div>',
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.';
});
}
}
});
|