@cleardu/core 1.0.520 → 1.0.522
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,6 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
export interface Response<T> {
|
|
4
4
|
data: T;
|
|
5
5
|
}
|
|
6
|
-
export declare class SuccessInterceptor implements NestInterceptor {
|
|
7
|
-
|
|
8
|
-
intercept(context: ExecutionContext, next: CallHandler): Observable<any>;
|
|
6
|
+
export declare class SuccessInterceptor<T> implements NestInterceptor<T, Response<T>> {
|
|
7
|
+
intercept(_: ExecutionContext, next: CallHandler): Observable<Response<T>>;
|
|
9
8
|
}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var SuccessInterceptor_1;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.SuccessInterceptor = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
6
5
|
const common_1 = require("@nestjs/common");
|
|
7
6
|
const operators_1 = require("rxjs/operators");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// .pipe(map((data) => ({ ...data, statusCode: HttpStatus.OK })));
|
|
14
|
-
// }
|
|
15
|
-
// }
|
|
16
|
-
let SuccessInterceptor = SuccessInterceptor_1 = class SuccessInterceptor {
|
|
17
|
-
constructor() {
|
|
18
|
-
this.logger = new common_1.Logger(SuccessInterceptor_1.name);
|
|
19
|
-
}
|
|
20
|
-
intercept(context, next) {
|
|
21
|
-
return next.handle().pipe((0, operators_1.tap)(response => {
|
|
22
|
-
}));
|
|
7
|
+
let SuccessInterceptor = class SuccessInterceptor {
|
|
8
|
+
intercept(_, next) {
|
|
9
|
+
return next
|
|
10
|
+
.handle()
|
|
11
|
+
.pipe((0, operators_1.map)((data) => ({ ...data, statusCode: common_1.HttpStatus.OK })));
|
|
23
12
|
}
|
|
24
13
|
};
|
|
25
14
|
exports.SuccessInterceptor = SuccessInterceptor;
|
|
26
|
-
exports.SuccessInterceptor = SuccessInterceptor =
|
|
15
|
+
exports.SuccessInterceptor = SuccessInterceptor = tslib_1.__decorate([
|
|
27
16
|
(0, common_1.Injectable)()
|
|
28
17
|
], SuccessInterceptor);
|
|
18
|
+
// @Injectable()
|
|
19
|
+
// export class SuccessInterceptor implements NestInterceptor {
|
|
20
|
+
// private readonly logger = new Logger(SuccessInterceptor.name);
|
|
21
|
+
// intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
|
|
22
|
+
// return next.handle().pipe(
|
|
23
|
+
// tap(response => {
|
|
24
|
+
// }),
|
|
25
|
+
// );
|
|
26
|
+
// }
|
|
27
|
+
// }
|
|
@@ -13,22 +13,22 @@ export interface Response<T> {
|
|
|
13
13
|
data: T;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
// @Injectable()
|
|
17
|
-
// export class SuccessInterceptor<T> implements NestInterceptor<T, Response<T>> {
|
|
18
|
-
// intercept(_: ExecutionContext, next: CallHandler): Observable<Response<T>> {
|
|
19
|
-
// return next
|
|
20
|
-
// .handle()
|
|
21
|
-
// .pipe(map((data) => ({ ...data, statusCode: HttpStatus.OK })));
|
|
22
|
-
// }
|
|
23
|
-
// }
|
|
24
|
-
|
|
25
16
|
@Injectable()
|
|
26
|
-
export class SuccessInterceptor implements NestInterceptor {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
);
|
|
33
|
-
}
|
|
17
|
+
export class SuccessInterceptor<T> implements NestInterceptor<T, Response<T>> {
|
|
18
|
+
intercept(_: ExecutionContext, next: CallHandler): Observable<Response<T>> {
|
|
19
|
+
return next
|
|
20
|
+
.handle()
|
|
21
|
+
.pipe(map((data) => ({ ...data, statusCode: HttpStatus.OK })));
|
|
22
|
+
}
|
|
34
23
|
}
|
|
24
|
+
|
|
25
|
+
// @Injectable()
|
|
26
|
+
// export class SuccessInterceptor implements NestInterceptor {
|
|
27
|
+
// private readonly logger = new Logger(SuccessInterceptor.name);
|
|
28
|
+
// intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
|
|
29
|
+
// return next.handle().pipe(
|
|
30
|
+
// tap(response => {
|
|
31
|
+
// }),
|
|
32
|
+
// );
|
|
33
|
+
// }
|
|
34
|
+
// }
|