Update login-page.component.ts

This commit is contained in:
2023-06-24 13:34:48 +02:00
parent 7890aed3b6
commit e1b8a3f2f3

View File

@@ -61,9 +61,7 @@ export class LoginPageComponent implements OnInit {
async handleCredentialResponse(response: any) { async handleCredentialResponse(response: any) {
try { try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const responsePayload: any = jwt_decode(response.credential); const responsePayload: any = jwt_decode(response.credential);
console.log('Response', response);
this.auth$.user = new User({ this.auth$.user = new User({
googleCredentials: response.credential, googleCredentials: response.credential,
@@ -71,20 +69,16 @@ export class LoginPageComponent implements OnInit {
email: responsePayload.email, email: responsePayload.email,
avatar: responsePayload.picture avatar: responsePayload.picture
}); });
console.log('AuthUser', this.auth$.user); this.ngZone$.run(() => {
this.loading = true;
//this.ngZone$.run(() => { });
// this.loading = true;
//});
this.auth$.googleCredential = response.credential; this.auth$.googleCredential = response.credential;
console.log(response.credential); console.log(response.credential);
await this.auth$.getAPIToken(); await this.auth$.getAPIToken();
console.log('after api token'); this.ngZone$.run(() => {
//this.ngZone$.run(() => { this.router$.navigate(['/app']);
// this.router$.navigate(['/app']); });
//});
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (e: any) { } catch (e: any) {
console.error('handleCredentialResponse', e); console.error('handleCredentialResponse', e);
this.ngZone$.run(() => { this.ngZone$.run(() => {