Created
September 20, 2023 05:03
-
-
Save YonatanKra/8f5a4b7a7ad4608d2078e2abe11e460a to your computer and use it in GitHub Desktop.
Tauri-demo: implement login attempt listener
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#handleLoginAttempt = (e: Event) => { | |
const { email, password } = (<CustomEvent>e).detail; | |
this.#authComponent?.login(email, password); | |
} | |
#setViewAccordingToUserStatus = () => { | |
if (!this.#authComponent!.isLoggedIn || this.#authComponent!.isLoggedIn?.() === false) { | |
this.shadowRoot!.innerHTML = `<yag-login></yag-login>`; | |
const loginElement = this.shadowRoot!.querySelector('yag-login') as HTMLElement; | |
loginElement.addEventListener('login-attempt', this.#handleLoginAttempt); | |
} else { | |
const loginElement = this.shadowRoot!.querySelector('yag-login') as HTMLElement; | |
loginElement?.removeEventListener('login-attempt', this.#handleLoginAttempt); | |
this.shadowRoot!.innerHTML = `<yag-greeter></yag-greeter>`; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment