diff --git a/frontend/src/app/services/fasten-api.service.ts b/frontend/src/app/services/fasten-api.service.ts index afc4b55d..94b7da12 100644 --- a/frontend/src/app/services/fasten-api.service.ts +++ b/frontend/src/app/services/fasten-api.service.ts @@ -7,8 +7,6 @@ import {ResponseWrapper} from '../models/response-wrapper'; import {Source} from '../models/fasten/source'; import {User} from '../models/fasten/user'; import {ResourceFhir} from '../models/fasten/resource_fhir'; -import {SourceSummary} from '../models/fasten/source-summary'; -import {Summary} from '../models/fasten/summary'; import {MetadataSource} from '../models/fasten/metadata-source'; @Injectable({ @@ -75,25 +73,6 @@ export class FastenApiService { /* SECURE ENDPOINTS */ - getSummary(): Observable { - return this._httpClient.get(`${this.getBasePath()}/api/secure/summary`, ) - .pipe( - map((response: ResponseWrapper) => { - console.log("Summary RESPONSE", response) - return response.data as Summary - }) - ); - } - - createSource(source: Source): Observable { - return this._httpClient.post(`${this.getBasePath()}/api/secure/source`, source) - .pipe( - map((response: ResponseWrapper) => { - console.log("SOURCE RESPONSE", response) - return response.data as Source - }) - ); - } createManualSource(file: File): Observable { @@ -109,36 +88,6 @@ export class FastenApiService { ); } - getSources(): Observable { - return this._httpClient.get(`${this.getBasePath()}/api/secure/source`) - .pipe( - map((response: ResponseWrapper) => { - console.log("SOURCE RESPONSE", response) - return response.data as Source[] - }) - ); - } - - getSource(sourceId: string): Observable { - return this._httpClient.get(`${this.getBasePath()}/api/secure/source/${sourceId}`) - .pipe( - map((response: ResponseWrapper) => { - console.log("SOURCE RESPONSE", response) - return response.data as Source - }) - ); - } - - getSourceSummary(sourceId: string): Observable { - return this._httpClient.get(`${this.getBasePath()}/api/secure/source/${sourceId}/summary`) - .pipe( - map((response: ResponseWrapper) => { - console.log("SOURCE RESPONSE", response) - return response.data as SourceSummary - }) - ); - } - syncSource(sourceId: string): Observable { return this._httpClient.post(`${this.getBasePath()}/api/secure/source/${sourceId}/sync`, {}) .pipe( diff --git a/frontend/src/app/services/lighthouse.service.ts b/frontend/src/app/services/lighthouse.service.ts index 91ec696b..e005631c 100644 --- a/frontend/src/app/services/lighthouse.service.ts +++ b/frontend/src/app/services/lighthouse.service.ts @@ -15,13 +15,13 @@ export class LighthouseService { constructor(private _httpClient: HttpClient) { } - getLighthouseSource(sourceType: string): Observable { + async getLighthouseSource(sourceType: string): Promise { return this._httpClient.get(`${environment.lighthouse_api_endpoint_base}/connect/${sourceType}`) .pipe( map((response: ResponseWrapper) => { return response.data as LighthouseSourceMetadata }) - ); + ).toPromise(); } @@ -61,7 +61,7 @@ export class LighthouseService { return authorizationUrl } - redirectWithOriginAndDestination(destUrl: string, sourceType: string){ + redirectWithOriginAndDestination(destUrl: string, sourceType: string): void { const originUrlParts = new URL(window.location.href) originUrlParts.hash = "" //reset hash in-case its present. originUrlParts.pathname = this.pathJoin([originUrlParts.pathname, `callback/${sourceType}`]) @@ -78,7 +78,7 @@ export class LighthouseService { window.location.href = redirectUrlParts.toString(); } - async swapOauthToken(sourceType: string, sourceMetadata: LighthouseSourceMetadata, expectedState: string, state: string, code: string){ + async swapOauthToken(sourceType: string, sourceMetadata: LighthouseSourceMetadata, expectedState: string, state: string, code: string): Promise{ // @ts-expect-error const client: oauth.Client = { client_id: sourceMetadata.client_id