diff --git a/src/composer/src/app/core/services/authentication.service.ts b/src/composer/src/app/core/services/authentication.service.ts index 44fe7e6..a8e92e6 100644 --- a/src/composer/src/app/core/services/authentication.service.ts +++ b/src/composer/src/app/core/services/authentication.service.ts @@ -21,7 +21,7 @@ export class AuthenticationService { return this.currentUserSubject.value; } - login(data: { username: string, password: string }) { + login(data: { email: string, password: string }) { return this.http.post(`${environment.apiUrl}/auth/login/`, data) .pipe(map(({token, user}) => { user.token = token diff --git a/src/composer/src/app/registration/registration.component.ts b/src/composer/src/app/registration/registration.component.ts index 6e4f7c8..eccfbcd 100644 --- a/src/composer/src/app/registration/registration.component.ts +++ b/src/composer/src/app/registration/registration.component.ts @@ -33,7 +33,16 @@ export class RegistrationComponent implements OnInit { .pipe(first()) .subscribe( data => { - this.router.navigate(['/auth/login']) + const { email, password1: password } = this.registrationForm.value + this.authenticationService.login({ email, password }) + .pipe(first()) + .subscribe( + data => { + this.router.navigate(['/']) + }, + (errors) => { + this.errors = errors + }); }, (errors) => { this.errors = errors