mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
new marketplace api service
This commit is contained in:
committed by
Aiden McClelland
parent
6d92c195e9
commit
48632271d5
@@ -8,6 +8,7 @@ import { PackageState } from 'src/app/services/patch-db/data-model'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { MarketplaceService } from '../marketplace.service'
|
||||
import { MarketplaceApiService } from 'src/app/services/api/marketplace-api.service'
|
||||
|
||||
@Component({
|
||||
selector: 'marketplace-list',
|
||||
@@ -36,6 +37,7 @@ export class MarketplaceListPage {
|
||||
|
||||
constructor (
|
||||
private readonly marketplaceService: MarketplaceService,
|
||||
private readonly marketplaceApiService: MarketplaceApiService,
|
||||
private readonly modalCtrl: ModalController,
|
||||
private readonly errToast: ErrorToastService,
|
||||
private readonly wizardBaker: WizardBaker,
|
||||
@@ -46,8 +48,8 @@ export class MarketplaceListPage {
|
||||
|
||||
try {
|
||||
const [data, eos, pkgs] = await Promise.all([
|
||||
this.marketplaceService.getMarketplaceData(),
|
||||
this.marketplaceService.getEos(),
|
||||
this.marketplaceApiService.getMarketplaceData({ }),
|
||||
this.marketplaceApiService.getEos({ }),
|
||||
this.getPkgs(),
|
||||
])
|
||||
this.data = data
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { MarketplacePkg } from 'src/app/services/api/api-types'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { MarketplaceApiService } from 'src/app/services/api/marketplace-api.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -12,19 +12,11 @@ export class MarketplaceService {
|
||||
} }
|
||||
|
||||
constructor (
|
||||
private readonly apiService: ApiService,
|
||||
private readonly marketplaceApiService: MarketplaceApiService,
|
||||
) { }
|
||||
|
||||
async getMarketplaceData () {
|
||||
return this.apiService.getMarketplaceData({ })
|
||||
}
|
||||
|
||||
async getEos () {
|
||||
return this.apiService.getEos({ })
|
||||
}
|
||||
|
||||
async getPkgs (category: string, query: string, page: number, perPage: number) : Promise<MarketplacePkg[]> {
|
||||
const pkgs = await this.apiService.getMarketplacePkgs({
|
||||
const pkgs = await this.marketplaceApiService.getMarketplacePkgs({
|
||||
category: category !== 'all' ? category : undefined,
|
||||
query,
|
||||
page: String(page),
|
||||
@@ -38,7 +30,7 @@ export class MarketplaceService {
|
||||
}
|
||||
|
||||
async getPkg (id: string, version?: string): Promise<void> {
|
||||
const pkg = (await this.apiService.getMarketplacePkgs({ id, version }))[0]
|
||||
const pkg = (await this.marketplaceApiService.getMarketplacePkgs({ id, version }))[0]
|
||||
if (pkg) {
|
||||
this.pkgs[id] = pkg
|
||||
} else {
|
||||
@@ -47,7 +39,7 @@ export class MarketplaceService {
|
||||
}
|
||||
|
||||
async getReleaseNotes (id: string): Promise<void> {
|
||||
this.releaseNotes[id] = await this.apiService.getReleaseNotes({ id })
|
||||
this.releaseNotes[id] = await this.marketplaceApiService.getReleaseNotes({ id })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user