mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-02-08 09:24:20 +01:00
Login and Register component separated
This commit is contained in:
parent
bd8eba9de1
commit
b1e895f69a
15 changed files with 2259 additions and 1104 deletions
|
|
@ -1 +0,0 @@
|
|||
<p>login works!</p>
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue