Generate Token

localStorage.setItem('token', Math.random().toString());
onLogin(): void {
  if (this.loginForm) {
    localStorage.setItem('token', Math.random().toString());
    const email = this.loginForm.get('formEmail')?.value;
    const password = this.loginForm.get('formPassword')?.value;
    this.auth
      .signInWithEmailAndPassword(email as string, password as string)
      .then(() => this.router.navigate(['/dashboard']))
      .catch((error) => {
        for (let errorType of Object.keys(this.erroreMessageMap)) {
          if (error.message.includes(errorType)) {
            this.error = this.erroreMessageMap[errorType];
            break;
          }
        }
      });
  }
}
Was this page helpful?