@anglr/rest
Version:
Angular module representing rest services
39 lines • 1.72 kB
JavaScript
import { Injectable, Injector, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HTTP_REQUEST_BASE_URL } from '@anglr/common';
import { REST_METHOD_MIDDLEWARES, REST_MIDDLEWARES_ORDER } from '../tokens';
import * as i0 from "@angular/core";
/**
* Base class for RESTClient class
*/
export class RESTClientBase {
constructor() {
//######################### protected properties #########################
/**
* Instance of http client
*/
this.http = inject(HttpClient);
/**
* Instance of injector used for obtaining DI
*/
this.injector = inject(Injector);
/**
* Array of rest middlewares in specific order in which will be middlewares executed
*/
this.middlewaresOrder = inject(REST_MIDDLEWARES_ORDER);
/**
* Array of middlewares that are executed for each http method
*/
this.methodMiddlewares = inject(REST_METHOD_MIDDLEWARES);
/**
* Base path that is prepended to request URL
*/
this.baseUrl = inject(HTTP_REQUEST_BASE_URL, { optional: true }) ?? '';
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: RESTClientBase, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: RESTClientBase }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: RESTClientBase, decorators: [{
type: Injectable
}] });
//# sourceMappingURL=restClientBase.js.map