Login and Register component separated

This commit is contained in:
Anish Gurung 2024-03-19 09:39:37 -07:00
parent bd8eba9de1
commit b1e895f69a
15 changed files with 2259 additions and 1104 deletions

View file

@ -1 +0,0 @@
<p>login works!</p>

View file

@ -1,27 +0,0 @@
import { Component } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/compat/auth';
import { Router } from '@angular/router';
@Component({
selector: 'ngx-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
export class LoginComponent {
email: string = '';
password: string = '';
errorMessage: string = '';
constructor(private afAuth: AngularFireAuth, private router: Router) {}
async login() {
try {
const userCredential = await this.afAuth.signInWithEmailAndPassword(this.email, this.password);
// If login successful, navigate to the home page or any other desired route
this.router.navigate(['/home']);
} catch (error) {
// Handle authentication errors
this.errorMessage = error.message;
}
}
}

View file

@ -7,7 +7,6 @@ import { DashboardModule } from './dashboard/dashboard.module';
import { ECommerceModule } from './e-commerce/e-commerce.module';
import { PagesRoutingModule } from './pages-routing.module';
import { MiscellaneousModule } from './miscellaneous/miscellaneous.module';
import { LoginComponent } from './login/login.component';
@NgModule({
imports: [
@ -20,7 +19,6 @@ import { LoginComponent } from './login/login.component';
],
declarations: [
PagesComponent,
LoginComponent,
],
})
export class PagesModule {