我根据Angular中返回的http响应显示alert .我的代码适用于Get和Post方法,但不适用于put和select方法.我被困在这里,如果有人能帮助我,我会非常高兴. ApiUrl.ts => 出口const AlertUrls:字符串[] = [ //后台服务URL]
我的拦截器.ts => 从"../"导入{ AlertUrls,collection } 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;
}),