diff --git a/dmp-frontend/src/app/app.component.ts b/dmp-frontend/src/app/app.component.ts index d7749bc34..9bf4b41f0 100644 --- a/dmp-frontend/src/app/app.component.ts +++ b/dmp-frontend/src/app/app.component.ts @@ -57,12 +57,10 @@ export class AppComponent implements OnInit { login(){ //redirect to login page this.router.navigate(['/login'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ }}); - location.reload(); } logout(){ this.tokenService.logout(); - location.reload(); } diff --git a/dmp-frontend/src/app/login/googgle-sign-in/googgle-sign-in.component.ts b/dmp-frontend/src/app/login/googgle-sign-in/googgle-sign-in.component.ts index c027a3e6f..1eeaa0cde 100644 --- a/dmp-frontend/src/app/login/googgle-sign-in/googgle-sign-in.component.ts +++ b/dmp-frontend/src/app/login/googgle-sign-in/googgle-sign-in.component.ts @@ -27,16 +27,6 @@ export class GooggleSignInComponent implements OnInit, AfterViewInit, Injectable } ngAfterViewInit() { - - /* - $( window ).on( "load", function(){ - - if($("#googleBtn").length == 0) { - alert("GoogleButton found"); - } - - }); - */ this.googleInit(); @@ -64,8 +54,16 @@ export class GooggleSignInComponent implements OnInit, AfterViewInit, Injectable cookiepolicy: 'single_host_origin', scope: this.scope }); + + //RE-Render the button (due to known issues of google-button with angular's lifecycle) + gapi.signin2.render('googleBtn', { + 'onsuccess': console.log("SUCCESSFULLY RERENDERED THE BUTTON"), + 'onfailure': console.log("FAILED TO RERENDER THE BUTTON") + }); + var buttonElement = this.element.nativeElement.querySelector('#googleBtn'); this.attachSignin(buttonElement); + }); } diff --git a/dmp-frontend/src/assets/custom.js b/dmp-frontend/src/assets/custom.js index 8aedaa9db..afc973797 100644 --- a/dmp-frontend/src/assets/custom.js +++ b/dmp-frontend/src/assets/custom.js @@ -2,7 +2,7 @@ var sign_out_google = (function() { var auth2 = gapi.auth2.getAuthInstance(); auth2.signOut().then(function () { - console.log('User signed out from google.'); + console.log('User signed out from google.'); }); }); diff --git a/dmp-frontend/src/index.html b/dmp-frontend/src/index.html index 26b0a0150..087aba354 100644 --- a/dmp-frontend/src/index.html +++ b/dmp-frontend/src/index.html @@ -49,16 +49,10 @@ - - + +