Skip to content

Commit

Permalink
Added support visibility for all APIs subscription in user profile (#948
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ygrik authored Sep 28, 2020
1 parent 8c87d4c commit a60efd1
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/services/productService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,19 @@ export class ProductService {

for (const subscription of subscriptions) {
const subscriptionModel = new Subscription(subscription);
const productName = Utils.getResourceName("products", subscription.properties.scope);

const productPromise = this.mapiClient
.get<ProductContract>(`/products/${productName}`)
.then(product => {
subscriptionModel.productName = product.properties.displayName;
});
if (subscription.properties.scope.endsWith("/apis")) {
subscriptionModel.productName = "All APIs";
} else {
const productName = Utils.getResourceName("products", subscription.properties.scope);

const productPromise = this.mapiClient
.get<ProductContract>(`/products/${productName}`)
.then(product => {
subscriptionModel.productName = product.properties.displayName;
});

promises.push(productPromise);
promises.push(productPromise);
}

const secretPromise = this.mapiClient
.post<SubscriptionSecrets>(`${userId}/subscriptions/${subscription.name}/listSecrets`)
Expand Down

0 comments on commit a60efd1

Please sign in to comment.