请求状态等通知提示抽取

This commit is contained in:
zhouyuejun
2019-01-23 10:40:58 +08:00
parent 4b22d58c4c
commit 7f7bb13847
10 changed files with 18 additions and 33 deletions
+3 -5
View File
@@ -3,8 +3,7 @@ import { Router } from '@angular/router';
import { HttpClient, HttpRequest, HttpHeaders, HttpParams } from '@angular/common/http';
import { HttpObserve } from '@angular/common/http/src/client';
import { OperateSpinServiceService } from './operate-spin-service.service';
import { ToastService } from '../components/toast/toast.service';
import { ToastConfig, ToastType } from '../components/toast/toast-model';
import { NzMessageService } from 'ng-zorro-antd';
import { Observable } from 'rxjs';
@@ -18,7 +17,7 @@ export class HttpClientService {
private router: Router,
private httpClient: HttpClient,
private operateSpinServiceService: OperateSpinServiceService,
private toastService: ToastService,
private message: NzMessageService
) { }
header: HttpHeaders = new HttpHeaders().set('x-requested-with', 'XMLHttpRequest')
@@ -136,8 +135,7 @@ export class HttpClientService {
};
case 500: {
this.operateSpinServiceService.hideSpin();
const toastCfg = new ToastConfig(ToastType.ERROR, '', '数据请求失败!', 5000);
this.toastService.toast(toastCfg);
this.message.error('数据请求失败!')
break;
}
}