I show an alert based on the http response returned in Angular. My code works in Get and post methods, but not in put and delete methods.I'm stuck here and would be very happy if someone could help me. ApiUrl.ts => export const AlertUrls: string[] = [ // backend service urls ]
my-interceptor.ts => import { AlertUrls, collection } from "../ApiUrl";
return next.handle(req).pipe(
map((response: any) => {
if ( AlertUrls.includes(req.url) && req.method !=='GET' && response instanceof HttpResponse && response.status === 200) {
this.alertService.showSuccessAlert();
}
return response;
}),
console.log(AlertUrls.includes(req.url), req.method !=='GET', response instanceof HttpResponse, response.status === 200)to check all the individual if conditions, if the debugger is giving you issues!