fix(register): fix nothing happening after registration (CAS-79) #198

Merged
csimonis merged 2 commits from bugfix/CAS-79 into main 2025-05-15 12:33:14 +00:00

View file

@ -1,6 +1,5 @@
import { Component, EventEmitter, Output, signal } from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { RegisterRequest } from '../../../model/auth/RegisterRequest';
import { AuthService } from '@service/auth.service';
import { CommonModule } from '@angular/common';
@ -22,8 +21,7 @@ export class RegisterComponent {
constructor(
private fb: FormBuilder,
private authService: AuthService,
private router: Router
private authService: AuthService
) {
this.registerForm = this.fb.group({
email: ['', [Validators.required, Validators.email]],
@ -56,6 +54,11 @@ export class RegisterComponent {
};
this.authService.register(registerRequest).subscribe({
next: () => {
this.isLoading.set(false);
this.closeDialog.emit();
this.switchToLogin();
},
error: (err: HttpErrorResponse) => {
this.isLoading.set(false);