Created
June 6, 2018 07:58
-
-
Save edewit/630a06073b760a0f6ca379b6d9f79d74 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index e58d090..681abf1 100644 | |
--- a/src/app/wizard/services/app-launcher-mission-runtime.service.ts | |
+++ b/src/app/wizard/services/app-launcher-mission-runtime.service.ts | |
@@ -7,11 +7,12 @@ import { | |
Mission, | |
MissionRuntimeService, | |
Runtime, | |
+ Catalog, | |
TokenProvider | |
} from 'ngx-forge'; | |
@Injectable() | |
-export class AppLauncherMissionRuntimeService implements MissionRuntimeService { | |
+export class AppLauncherMissionRuntimeService extends MissionRuntimeService { | |
private END_POINT: string; | |
private API_BASE: string = '/booster-catalog/'; | |
@@ -22,10 +23,9 @@ export class AppLauncherMissionRuntimeService implements MissionRuntimeService { | |
private helperService: HelperService, | |
private tokenProvider: TokenProvider | |
) { | |
- if (this.helperService) { | |
- this.END_POINT = this.helperService.getBackendUrl(); | |
- this.ORIGIN = this.helperService.getOrigin(); | |
- } | |
+ super(); | |
+ this.END_POINT = this.helperService.getBackendUrl(); | |
+ this.ORIGIN = this.helperService.getOrigin(); | |
} | |
private get options(): Observable<RequestOptions> { | |
@@ -39,22 +39,12 @@ export class AppLauncherMissionRuntimeService implements MissionRuntimeService { | |
})); | |
} | |
- getMissions(): Observable<Mission[]> { | |
- let missionEndPoint: string = this.END_POINT + this.API_BASE + 'missions'; | |
- return this.options.flatMap((option) => { | |
- return this.http.get(missionEndPoint, option) | |
- .map(response => response.json() as Mission[]) | |
- .catch(this.handleError); | |
- }); | |
- } | |
- | |
- getRuntimes(): Observable<Runtime[]> { | |
- let runtimeEndPoint: string = this.END_POINT + this.API_BASE + 'runtimes'; | |
- return this.options.flatMap((option) => { | |
- return this.http.get(runtimeEndPoint, option) | |
- .map(response => response.json() as Runtime[]) | |
+ getCatalog(): Observable<Catalog> { | |
+ return this.options.flatMap(option => { | |
+ return this.http.get(this.END_POINT + this.API_BASE, option) | |
+ .map(response => response.json() as Catalog) | |
.catch(this.handleError); | |
- }); | |
+ }) | |
} | |
private handleError(error: Response | any) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment