Fix login page update side effect (#77)

closes #76
This commit is contained in:
sua yoo 2022-01-12 16:43:34 -08:00 committed by GitHub
parent 5258149a34
commit 5492eca117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,15 +148,11 @@ export class LogInPage extends LiteElement {
this.formStateService.stop();
}
updated(changedProperties: any) {
if (changedProperties.has("viewState")) {
const route = this.viewState.route;
async updated(changedProperties: any) {
if (changedProperties.get("viewState")) {
await this.updateComplete;
if (route === "login") {
this.formStateService.send("SHOW_SIGN_IN_WITH_PASSWORD");
} else if (route === "forgotPassword") {
this.formStateService.send("SHOW_FORGOT_PASSWORD");
}
this.syncFormStateView();
}
}
@ -210,6 +206,16 @@ export class LogInPage extends LiteElement {
`;
}
private syncFormStateView() {
const route = this.viewState.route;
if (route === "login") {
this.formStateService.send("SHOW_SIGN_IN_WITH_PASSWORD");
} else if (route === "forgotPassword") {
this.formStateService.send("SHOW_FORGOT_PASSWORD");
}
}
private renderLoginForm() {
let formError;