From 4e9d5a10c44c560b0dc4dc67ae8601b5ccba23c3 Mon Sep 17 00:00:00 2001 From: Nikita Nek Dudnik Date: Thu, 28 May 2020 16:04:52 +0200 Subject: [PATCH] feature: add real get entity by name --- plugins/catalog/src/api/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/catalog/src/api/index.ts b/plugins/catalog/src/api/index.ts index 1bc739b56f..83c0eb1cfd 100644 --- a/plugins/catalog/src/api/index.ts +++ b/plugins/catalog/src/api/index.ts @@ -41,8 +41,10 @@ export class CatalogApi { return await response.json(); } async getEntityByName(name: string): Promise { - const entities = await this.getEntities(); - const entity = entities.find(e => e.metadata.name === name); + const response = await fetch( + `${this.apiOrigin}${this.basePath}/entities/by-name/Component/default/${name}`, + ); + const entity = await response.json(); if (entity) return entity; throw new Error(`'Entity not found: ${name}`); }