Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {CallHandler, ExecutionContext, Injectable, NestInterceptor,} from '@nestjs/common';
- import {map, Observable} from 'rxjs';
- @Injectable()
- export class TestInterceptor implements NestInterceptor {
- intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
- // add logic before handler
- // response RxJs (observable)
- return next.handle().pipe(
- map((value) => {
- return {
- error: false,
- data: value
- };
- }),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement