|
|
@@ -9,7 +9,6 @@ import { Observable } from 'rxjs';
|
|
|
import { map } from 'rxjs/operators';
|
|
|
import { CustomFields } from 'shared/shared-types';
|
|
|
|
|
|
-import { API_URL } from '../../app.config';
|
|
|
import { LocalStorageService } from '../../core/providers/local-storage/local-storage.service';
|
|
|
import { addCustomFields } from '../add-custom-fields';
|
|
|
import { QueryResult } from '../query-result';
|
|
|
@@ -71,37 +70,4 @@ export class BaseDataService {
|
|
|
})
|
|
|
.pipe(map(result => result.data as T));
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * Perform REST-like POST
|
|
|
- */
|
|
|
- post(path: string, payload: Record<string, any>): Observable<any> {
|
|
|
- return this.httpClient
|
|
|
- .post(`${API_URL}/${path}`, payload, {
|
|
|
- headers: {
|
|
|
- Authorization: this.getAuthHeader(),
|
|
|
- },
|
|
|
- observe: 'response',
|
|
|
- })
|
|
|
- .pipe(map(response => response.body));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Perform REST-like GET
|
|
|
- */
|
|
|
- get(path: string): Observable<any> {
|
|
|
- return this.httpClient
|
|
|
- .get(`${API_URL}/${path}`, {
|
|
|
- headers: {
|
|
|
- Authorization: this.getAuthHeader(),
|
|
|
- },
|
|
|
- observe: 'response',
|
|
|
- })
|
|
|
- .pipe(map(response => response.body));
|
|
|
- }
|
|
|
-
|
|
|
- private getAuthHeader(): string {
|
|
|
- const authToken = this.localStorageService.get('authToken');
|
|
|
- return `Bearer ${authToken}`;
|
|
|
- }
|
|
|
}
|