fix: update core and apply stricter tslint rules

This commit is contained in:
Michel Jonathan Schmitz
2019-07-10 12:38:29 +02:00
parent 03c317430a
commit 911492d064
67 changed files with 1291 additions and 507 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 StApps
* Copyright (C) 2018, 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -14,15 +14,18 @@
*/
import {HttpClient, HttpResponse} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {HttpClientInterface} from '@openstapps/api/lib/httpClientInterface';
import {HttpClientRequest} from '@openstapps/api/lib/httpClientInterface';
import {HttpClientInterface, HttpClientRequest} from '@openstapps/api/lib/http-client-interface';
/**
* HttpClient that is based on angular's HttpClient (@TODO: move it to provider or independent package)
*/
@Injectable()
export class StAppsWebHttpClient implements HttpClientInterface {
constructor(private http: HttpClient) {
/**
*
* @param http TODO
*/
constructor(private readonly http: HttpClient) {
}
/**
@@ -33,7 +36,13 @@ export class StAppsWebHttpClient implements HttpClientInterface {
requestConfig: HttpClientRequest,
): Promise<Response<TYPE_OF_BODY>> {
const options: {
/**
* TODO
*/
[key: string]: any;
/**
* TODO
*/
observe: 'response';
} = {
body: {},
@@ -53,6 +62,7 @@ export class StAppsWebHttpClient implements HttpClientInterface {
const response: HttpResponse<TYPE_OF_BODY> = await this.http.request<TYPE_OF_BODY>(
requestConfig.method || 'GET', requestConfig.url.toString(), options)
.toPromise();
return Object.assign(response, {statusCode: response.status, body: response.body || {}});
} catch (err) {
throw Error(err);
@@ -64,6 +74,12 @@ export class StAppsWebHttpClient implements HttpClientInterface {
* Response with generic for the type of body that is returned from the request
*/
export interface Response<TYPE_OF_BODY> extends HttpResponse<TYPE_OF_BODY> {
/**
* TODO
*/
body: TYPE_OF_BODY;
/**
* TODO
*/
statusCode: number;
}