fix(frontend): replace HttpClient with generated AuthenticationService in verify-email
This commit is contained in:
parent
ef4eefa4cd
commit
c180d6fd32
@ -1,32 +1,26 @@
|
|||||||
import {Component, inject, OnInit} from '@angular/core';
|
import {Component, inject, OnInit} from '@angular/core';
|
||||||
import {ActivatedRoute, RouterLink} from '@angular/router';
|
import {ActivatedRoute, RouterLink} from '@angular/router';
|
||||||
import {HttpClient} from '@angular/common/http';
|
import {AuthenticationService} from '../../api';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-verify-email',
|
selector: 'app-verify-email',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [RouterLink], // CommonModule wird für die neue Control Flow Syntax nicht mehr benötigt!
|
imports: [RouterLink],
|
||||||
templateUrl: './verify-email.html',
|
templateUrl: './verify-email.html',
|
||||||
styleUrl: './verify-email.scss'
|
styleUrl: './verify-email.scss'
|
||||||
})
|
})
|
||||||
export class VerifyEmailComponent implements OnInit {
|
export class VerifyEmailComponent implements OnInit {
|
||||||
private route = inject(ActivatedRoute);
|
private route = inject(ActivatedRoute);
|
||||||
|
private authService = inject(AuthenticationService);
|
||||||
// Tipp: Hier später idealerweise deinen OpenAPI-generierten Service verwenden,
|
|
||||||
// z.B. private authService = inject(AuthenticationService);
|
|
||||||
private http = inject(HttpClient);
|
|
||||||
|
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
isSuccess = false;
|
isSuccess = false;
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
const token = this.route.snapshot.queryParamMap.get('token');
|
const token = this.route.snapshot.queryParamMap.get('token');
|
||||||
// Ggf. atNumber auslesen, falls du sie hier mit übergibst
|
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
// Wenn du OpenAPI nutzt, kannst du hier die entsprechende Methode aufrufen.
|
this.authService.verifyEmail(token).subscribe({
|
||||||
// Fürs Beispiel als direkter HTTP-Call:
|
|
||||||
this.http.get(`http://localhost:8080/api/auth/verify-email?token=${token}`).subscribe({
|
|
||||||
next: () => {
|
next: () => {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.isSuccess = true;
|
this.isSuccess = true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user