Change the first character of all end-of-line comments to upper case

This commit is contained in:
2021-01-18 14:26:40 +01:00
parent c2aead6799
commit f0ed0a0e68
27 changed files with 305 additions and 305 deletions

View File

@ -24,7 +24,7 @@ export class ApiService {
return this.host;
}
// main HTTP methods
// Main HTTP methods
get<T>(url, f: (data?: T, err?, headers?) => void = () => {}) {
this.requestErrorHandler<T>(this.http.get(this.url(url), this.options()), f);
}
@ -41,25 +41,25 @@ export class ApiService {
this.requestErrorHandler<T>(this.http.delete(this.url(url), this.options()), f);
}
// execute request and handle errors
// Execute request and handle errors
private requestErrorHandler<T>(observable: Observable<any>, f: (data?: T, err?, headers?) => void) {
observable.subscribe(data => { // successful request
observable.subscribe(data => { // Successful request
f(
data.body,
undefined,
data.headers.keys().reduce((s, e) => {s[e.toLowerCase()] = data.headers.get(e); return s; }, {})
);
}, err => { // error
if (f.length > 1) { // pass on error
}, err => { // Error
if (f.length > 1) { // Pass on error
f(undefined, err, undefined);
}
else { // handle directly
else { // Handle directly
this.requestError(err);
}
});
}
requestError(err) { // network error dialog
requestError(err) { // Network error dialog
const modalRef = this.modalService.openComponent(ErrorComponent);
modalRef.instance.message = 'Network request failed!';
const details = [err.error.status];
@ -72,7 +72,7 @@ export class ApiService {
});
}
private url(url) { // detect if host was given, otherwise use default host
private url(url) { // Detect if host was given, otherwise use default host
if (/http[s]?:\/\//.test(url)) {
return url;
}
@ -81,12 +81,12 @@ export class ApiService {
}
}
// generate request options
// Generate request options
private options(): {headers: HttpHeaders, observe: 'body'} {
return {headers: this.authOptions(), observe: 'response' as 'body'};
}
// generate Basic Auth
// Generate Basic Auth
private authOptions(): HttpHeaders {
const auth = this.storage.get('basicAuth');
if (auth) {