mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
update indentation
This commit is contained in:
parent
07c827ec1b
commit
7efcaed733
@ -7,7 +7,7 @@ import {Config} from '../../../../common/config/public/Config';
|
||||
import {Utils} from '../../../../common/Utils';
|
||||
import {CustomHeaders} from '../../../../common/CustomHeaders';
|
||||
import {VersionService} from '../version.service';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import {lastValueFrom} from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class NetworkService {
|
||||
@ -15,9 +15,9 @@ export class NetworkService {
|
||||
private globalErrorHandlers: Array<(error: ErrorDTO) => boolean> = [];
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private loadingBarService: LoadingBarService,
|
||||
private versionService: VersionService
|
||||
private http: HttpClient,
|
||||
private loadingBarService: LoadingBarService,
|
||||
private versionService: VersionService
|
||||
) {
|
||||
}
|
||||
|
||||
@ -52,9 +52,9 @@ export class NetworkService {
|
||||
};
|
||||
|
||||
return lastValueFrom(this.http
|
||||
.get(this.apiBaseUrl + url, {responseType: 'text'}))
|
||||
.then(process)
|
||||
.catch(err);
|
||||
.get(this.apiBaseUrl + url, {responseType: 'text'}))
|
||||
.then(process)
|
||||
.catch(err);
|
||||
}
|
||||
|
||||
public getText(url: string): Promise<string> {
|
||||
@ -71,9 +71,9 @@ export class NetworkService {
|
||||
};
|
||||
|
||||
return lastValueFrom(this.http
|
||||
.get(this.apiBaseUrl + url, {responseType: 'text'}))
|
||||
.then(process)
|
||||
.catch(err);
|
||||
.get(this.apiBaseUrl + url, {responseType: 'text'}))
|
||||
.then(process)
|
||||
.catch(err);
|
||||
}
|
||||
|
||||
public postJson<T>(url: string, data = {}): Promise<T> {
|
||||
@ -97,9 +97,9 @@ export class NetworkService {
|
||||
}
|
||||
|
||||
private callJson<T>(
|
||||
method: 'get' | 'post' | 'delete' | 'put',
|
||||
url: string,
|
||||
data = {}
|
||||
method: 'get' | 'post' | 'delete' | 'put',
|
||||
url: string,
|
||||
data = {}
|
||||
): Promise<T> {
|
||||
const body = data;
|
||||
|
||||
@ -110,7 +110,7 @@ export class NetworkService {
|
||||
const msg = res.body;
|
||||
if (res.headers.has(CustomHeaders.dataVersion)) {
|
||||
this.versionService.onNewVersion(
|
||||
res.headers.get(CustomHeaders.dataVersion)
|
||||
res.headers.get(CustomHeaders.dataVersion)
|
||||
);
|
||||
}
|
||||
if (msg.error) {
|
||||
@ -130,26 +130,26 @@ export class NetworkService {
|
||||
switch (method) {
|
||||
case 'get':
|
||||
return lastValueFrom(this.http
|
||||
.get<Message<T>>(this.apiBaseUrl + url, {observe: 'response'}))
|
||||
.then(process)
|
||||
.catch(err);
|
||||
.get<Message<T>>(this.apiBaseUrl + url, {observe: 'response'}))
|
||||
.then(process)
|
||||
.catch(err);
|
||||
case 'delete':
|
||||
return lastValueFrom(this.http
|
||||
.delete<Message<T>>(this.apiBaseUrl + url, {observe: 'response'}))
|
||||
.then(process)
|
||||
.catch(err);
|
||||
.delete<Message<T>>(this.apiBaseUrl + url, {observe: 'response'}))
|
||||
.then(process)
|
||||
.catch(err);
|
||||
case 'post':
|
||||
return lastValueFrom(this.http
|
||||
.post<Message<T>>(this.apiBaseUrl + url, body, {
|
||||
observe: 'response',
|
||||
}))
|
||||
.then(process)
|
||||
.catch(err);
|
||||
.post<Message<T>>(this.apiBaseUrl + url, body, {
|
||||
observe: 'response',
|
||||
}))
|
||||
.then(process)
|
||||
.catch(err);
|
||||
case 'put':
|
||||
return lastValueFrom(this.http
|
||||
.put<Message<T>>(this.apiBaseUrl + url, body, {observe: 'response'}))
|
||||
.then(process)
|
||||
.catch(err);
|
||||
.put<Message<T>>(this.apiBaseUrl + url, body, {observe: 'response'}))
|
||||
.then(process)
|
||||
.catch(err);
|
||||
default:
|
||||
throw new Error('Unknown method');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user