Answer the question
In order to leave comments, you need to log in
How to make this component?
Created a component for authorization in the system. In it, after submitting the form and receiving a token, a redirect occurs.
submitForm() {
this.blockButton = true;
this.authService.signIn(this.signInForm.getRawValue()).subscribe(
data => {
this.authService.setAuthorizationToken(data);
this.authService.updateCurrentMemberData();
},
error => {
this.blockButton = false;
},
() => {
this.router.navigate([this.authService.redirectUrl]);
}
);
}
Answer the question
In order to leave comments, you need to log in
As an option, make a stub component,
1. on the button, log in output auth, which emits a click event, process everything where this component is used in the parent as needed
2. You can complicate the output :
When you click on the button, make a request to the service
submitSubject = BehaviorSubject(null)
@Output() auth = this.submitSubject.pipe(switchMap( _ => this.auth.signin(this.form.value))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question