Hey, it would be great if you could add your my-app.js as well where you add your login-page. It looks like to me that there are two instances of login-page otherwise the checks you have implemented would prevent the second login page to be called. So my guess is somewhere/somehow you are instantiating two login-pages and it's not that constructor is being called twice in the same instance of login-page. Cheers
On Wednesday, January 30, 2019 at 5:00:48 AM UTC-7, [email protected] wrote: > > Hi, we are developing a web app using pwastater kit and polymer js 3.0,i > am facing an issue once my component is invoked the constructor is calling > two times because of this my login service is calling twice, i am placing > my login component in my-app component. please find the below code snippet > of my login component. > > import { LitElement, html } from '@polymer/lit-element'; > import { GetLoginJwt } from '../../framework/repository/jwt.repository.js' > ; > import { BindMessageListener } from > '../../framework/services/frame-message-listener.service.js'; > import { AppConstants } from '../../framework/constants/app.constants.js'; > import { LogInPopUp,IsUserLoggedIn,GetPopUpHtml } from > '../../components/message-popup.component.js'; > import {ExceptionHandlerService} from > '../../framework/services/exception-handler.service' > import {ExceptionModel} from > '../../framework/models/exception-data.model.js' > > class Login extends LitElement { > render(props) { > return html` > `; > } > static get properties() { > return { > LoginURL: { type: String } > } > } > > constructor() { > super(); > if(document.getElementById("paperDialogBox")==null){ > LogInPopUp(); > IsUserLoggedIn().then(status=>{ > if(!status){ > this.LoginURL = "about:blank"; > loginModelPopup.open(); > this.GetLoginURL(); > } > }); > } > } > > GetLoginURL() { > this.GenerateLoginUrl(); > } > > async GenerateLoginUrl() { > var encryptedJwt = ''; > await GetLoginJwt().then(data => { > encryptedJwt = data; > }); > let appConstants = new AppConstants(); > this.LoginURL = appConstants.LoginUrl + encryptedJwt; > loginIframe.setAttribute('src',this.LoginURL); > BindMessageListener(); > } > > } > > window.customElements.define('login-page', Login); > > Thanks > Nisanth > Follow Polymer on Google+: plus.google.com/107187849809354688692 --- You received this message because you are subscribed to the Google Groups "Polymer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/b4e54213-93b2-4f29-b811-c76b52e4d7a2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
