This commit is contained in:
Taric Xin
2021-12-17 16:03:27 +08:00
parent 6d65ead997
commit 92c844a2b5
11 changed files with 149 additions and 225 deletions

View File

@ -5,7 +5,7 @@ import {
HttpInterceptor,
HttpRequest,
HttpResponse,
HttpResponseBase,
HttpResponseBase
} from '@angular/common/http';
import { Inject, Injectable, Optional } from '@angular/core';
import { DA_SERVICE_TOKEN, ITokenService } from '@delon/auth';
@ -21,7 +21,7 @@ export class BusinessInterceptor implements HttpInterceptor {
private eaUserSrv: EAUserService,
@Optional()
@Inject(DA_SERVICE_TOKEN)
private tokenSrv: ITokenService,
private tokenSrv: ITokenService
) {}
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
// 构造新的请求URL
@ -30,8 +30,8 @@ export class BusinessInterceptor implements HttpInterceptor {
req = this.attachAdditionalHeaders(req);
// 后续操作
return next.handle(req).pipe(
mergeMap((ev) => this.handlingBussinessResponseData(ev)),
catchError((err: HttpErrorResponse) => this.handlingBusinessErrors(err)),
mergeMap(ev => this.handlingBussinessResponseData(ev)),
catchError((err: HttpErrorResponse) => this.handlingBusinessErrors(err))
);
}
@ -56,6 +56,7 @@ export class BusinessInterceptor implements HttpInterceptor {
const header: any = {
appId: this.envSrv.env.appId,
tenantId: this.envSrv.env.tenantId,
enterpriseId: '0'
};
// 附加授权声明