Парсинг interceptor response

Reading time ~1 minute

Пример парсинга responsa’а в интерсепторе Angular:

intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
    return next.handle(this.setHeader(request)).pipe(
        map((response: HttpEvent<unknown>) => {
            if (request.url === '/api/v1/sdi/page' && response instanceof HttpResponse) {
                const body = JSON.parse(JSON.stringify(response.body));
                body.layout.blocks[0].components[2].columns[2].type = 'phone';
                body.layout.blocks[0].components[2].filter.static[3].type = 'phone';
                response = response.clone({ body });
                console.log('response >>>', response);
        }
        return response;
    }));
}

Mangling Angular

Angular Builder поддерживает параметры среды:- NG_BUILD_MANGLE- NG_BUILD_MINIFY- NG_BUILD_BEAUTIFYМожно установить их при запуске скрипта...… Continue reading

Constructor parameter without access modifier

Published on February 04, 2024

RxJs and DestroyRef Provider

Published on January 24, 2024