File

projects/maplander/core/src/lib/interceptors/translate/server-translate.interceptor.ts

Index

Methods

Constructor

constructor()

Methods

intercept
intercept(request: HttpRequest, next: HttpHandler)
Parameters :
Name Type Optional
request HttpRequest<any> No
next HttpHandler No
Returns : any
import {HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';
import {Injectable} from '@angular/core';

@Injectable()
export class TranslateInterceptor implements HttpInterceptor {

  constructor() {
  }

  intercept(request: HttpRequest<any>, next: HttpHandler) {
    if (request.url.includes('i18n')) {
      const url = '' + request.url.replace('./assets', 'assets');
      request = request.clone({
        url: url
      });
    }
    return next.handle(request);
  }

}

result-matching ""

    No results matching ""