Is there a better way to prevent multiple submissions of a login form using the switchMap operator?
I've attempted to utilize subjects without success. Below is my current code.
import { Subject } from 'rxjs';
import { Component, Output } from '@angular/core';
private submitStream = new Subject<Event>();
@Output() observ = this.submitStream.asObservable();
formSubmit(event: Event) {
this.submitStream.next(event);
}
In the HTML, I have the following on button click:
(click)="formSubmit($event)"
How can I achieve the desired functionality without relying on subjects?
The desired behavior should be that only the last submission will be sent to the backend API, cancelling any previous ones when the submit button is clicked multiple times.