mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 09:32:41 +00:00
refactor: replace TSLint with ESLint
This commit is contained in:
committed by
Jovan Krunić
parent
67fb4a43c9
commit
d696215d08
@@ -14,7 +14,10 @@
|
||||
*/
|
||||
import {HttpClient, HttpResponse} from '@angular/common/http';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpClientInterface, HttpClientRequest} from '@openstapps/api/lib/http-client-interface';
|
||||
import {
|
||||
HttpClientInterface,
|
||||
HttpClientRequest,
|
||||
} from '@openstapps/api/lib/http-client-interface';
|
||||
|
||||
/**
|
||||
* HttpClient that is based on the Angular HttpClient (@TODO: move it to provider or independent package)
|
||||
@@ -25,11 +28,11 @@ export class StAppsWebHttpClient implements HttpClientInterface {
|
||||
*
|
||||
* @param http TODO
|
||||
*/
|
||||
constructor(private readonly http: HttpClient) {
|
||||
}
|
||||
constructor(private readonly http: HttpClient) {}
|
||||
|
||||
/**
|
||||
* Make a request
|
||||
*
|
||||
* @param requestConfig Configuration of the request
|
||||
*/
|
||||
async request<TYPE_OF_BODY>(
|
||||
@@ -59,14 +62,21 @@ export class StAppsWebHttpClient implements HttpClientInterface {
|
||||
}
|
||||
|
||||
try {
|
||||
const response: HttpResponse<TYPE_OF_BODY> = await this.http.request<TYPE_OF_BODY>(
|
||||
requestConfig.method || 'GET', requestConfig.url.toString(), options)
|
||||
const response: HttpResponse<TYPE_OF_BODY> = await this.http
|
||||
.request<TYPE_OF_BODY>(
|
||||
requestConfig.method || 'GET',
|
||||
requestConfig.url.toString(),
|
||||
options,
|
||||
)
|
||||
.toPromise();
|
||||
|
||||
// tslint:disable-next-line:prefer-object-spread
|
||||
return Object.assign(response, {statusCode: response.status, body: response.body || {}});
|
||||
} catch (err) {
|
||||
throw Error(err);
|
||||
// eslint-disable-next-line prefer-object-spread
|
||||
return Object.assign(response, {
|
||||
statusCode: response.status,
|
||||
body: response.body || {},
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user