first commit

This commit is contained in:
Bastian Wagner
2026-07-31 21:02:47 +02:00
commit 6bea4f766a
512 changed files with 64459 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
import { Component } from '@angular/core';
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { MatSnackBar } from '@angular/material/snack-bar';
import { AuthService } from '../../auth.service';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
export class LoginComponent {
loginFailed = false;
constructor(private authService: AuthService, private router: Router, private snackBar: MatSnackBar) {
}
loginForm = new FormGroup({
email: new FormControl('', [Validators.required, Validators.email]),
password: new FormControl('', [Validators.required])
});
async login() {
const email = this.loginForm.controls.email.value + '';
const password = this.loginForm.controls.password.value + ''
this.loginFailed = false;
const success = await this.authService.login(email, password);
if (success) {
this.router.navigate(['/dashboard']).then();
} else {
this.loginFailed = true;
this.snackBar.open('E-Mail oder Passwort ist falsch', undefined, {
duration: 5000,
panelClass: 'snackbar_error'
});
}
}
}