Spaces:
Sleeping
Sleeping
File size: 1,308 Bytes
88bf46c 27e40c0 88bf46c 27e40c0 88bf46c 27e40c0 88bf46c 27e40c0 88bf46c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
import { Component } from '@angular/core';
import {MatCard} from "@angular/material/card";
import {FormsModule} from "@angular/forms";
import {MatFormField, MatLabel} from "@angular/material/form-field";
import {MatButton} from "@angular/material/button";
import {MatInput} from "@angular/material/input";
import {AppStateService} from "../../../../state_management/services/app-state.service";
import {map} from "rxjs";
import {AsyncPipe, NgIf} from "@angular/common";
import {Router, RouterModule} from "@angular/router";
@Component({
selector: 'app-admin-login',
standalone: true,
imports: [
MatCard,
FormsModule,
MatFormField,
MatButton,
MatInput,
MatLabel,
NgIf,
AsyncPipe,
RouterModule
],
templateUrl: './admin-login.component.html',
styleUrl: './admin-login.component.css'
})
export class AdminLoginComponent {
password: string = '';
constructor(private stateService: AppStateService,
private router: Router
) {}
authenticationState = this.stateService.state$.pipe(
map(state => state.adminSessionStatus)
);
onSubmit() {
this.stateService.authenticate(this.password).subscribe(
next => {
console.log('Authentication successful');
this.router.navigate(['/control-panel']);
}
);
}
}
|