请求状态等通知提示抽取
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user