diff --git a/src/app/page/auth/signup/signup.component.html b/src/app/page/auth/signup/signup.component.html index b51618bd..bf036bfb 100644 --- a/src/app/page/auth/signup/signup.component.html +++ b/src/app/page/auth/signup/signup.component.html @@ -19,7 +19,7 @@
@@ -35,7 +35,7 @@
@@ -53,7 +53,7 @@
diff --git a/src/app/page/auth/signup/signup.component.ts b/src/app/page/auth/signup/signup.component.ts index f4a48ad3..032febc5 100644 --- a/src/app/page/auth/signup/signup.component.ts +++ b/src/app/page/auth/signup/signup.component.ts @@ -1,26 +1,15 @@ -import {Component, DestroyRef, inject, model} from '@angular/core'; -import {FeedbackMessageComponent} from "../../../component/feedback-message/feedback-message.component"; +import {Component, DestroyRef, inject, model, signal} from '@angular/core'; import {FormsModule, NgForm, ReactiveFormsModule} from "@angular/forms"; import {NgIf} from "@angular/common"; import {RouterLink} from "@angular/router"; import {LOGIN_PAGE_INFO} from "../../../model/page.info.model"; import {takeUntilDestroyed} from "@angular/core/rxjs-interop"; -import {RegistrationService} from "../../../service/registration/registration.service"; - -export class SignupForm { - constructor( - public name: string = '', - public username: string = '', - public password: string = '' - ) { - } -} +import {RegistrationService, SignupRequest} from "../../../service/registration/registration.service"; @Component({ selector: 'app-signup', standalone: true, imports: [ - FeedbackMessageComponent, FormsModule, NgIf, ReactiveFormsModule, @@ -31,10 +20,15 @@ export class SignupForm { }) export class SignupComponent { protected readonly LOGIN_PAGE_INFO = LOGIN_PAGE_INFO; + destroyRef = inject(DestroyRef); registrationService = inject(RegistrationService); - form = new SignupForm(); + form = signal({ + username: '', + password: '', + name: '' + }); isSuccessful = model(false); isErrorOccurred = model(false); @@ -42,11 +36,8 @@ export class SignupComponent { this.isSuccessful.set(false); if (signupForm.valid) { - this.registrationService.signup({ - username: this.form.username, - password: this.form.password, - name: this.form.name - }).pipe(takeUntilDestroyed(this.destroyRef)) + this.registrationService.signup(this.form()) + .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe({ next: _ => this.onSuccessCallback(), error: err => this.onErrorCallback(err)