For people who have the same issue:
It was fixed by using the ngOnDestroy
event of Angular. You need to unsubscribe from these requests because they are not canceled otherwise:
Example:
export class MyComponent implements OnDestroy {
private subscriptions: Subscription[] = []
ngOnDestroy(): void {
this.subscriptions.forEach(s => s.unsubscribe());
}
myApiFunction(feature_id: number, vote: boolean): void {
const feature_vote: Subscription = this.apiService.sendFeatureVote().subscribe({
next: (_data: any): void => {
// do something
},
error: (error: HttpErrorResponse): void => {
// do something
}
});
this.subscriptions.push(feature_vote);
}
}