/
lingvo
/
LinguaCode
Обзор
Документация
Войти
/
lingvo
/
LinguaCode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/app/core/api/error.interceptor.ts
16 строк
485 B
Alexander Soloviev
[7_api-data] add core API layer with interceptors and response types
13 июн 2026, 15:39
13 июн 2026, 15:39
6c5fbbc
Код
Авторство
О чём код?
import { HttpInterceptorFn } from '@angular/common/http'; import { catchError, throwError } from 'rxjs'; import { isApiRequest } from './api-url'; import { toHttpApiError } from './api-error.utils'; export const errorInterceptor: HttpInterceptorFn = (req, next) => { return next(req).pipe( catchError((error: unknown) => { if (!isApiRequest(req.url)) { return throwError(() => error); } return throwError(() => toHttpApiError(error)); }), ); };