mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-12 19:27:09 +00:00

* Releases updated version of datahub-web client UI code * Fix typo in yarn lock * Change yarn lock to match yarn registry directories * Previous commit missed some paths * Even more changes to yarnlock missing in previous commit * Include codegen file for typings * Add files to get parity for datahub-web and current OS datahub-midtier * Add in typo fix from previous commit - change to proper license * Implement proper OS fix for person entity picture url * Workarounds for open source DH issues * Fixes institutional memory api and removes unopensourced tabs for datasets * Fixes search dataset deprecation and user search issue as a result of changes * Remove internal only options in the avatar menu
23 lines
815 B
TypeScript
23 lines
815 B
TypeScript
import { getJSON } from '@datahub/utils/api/fetcher';
|
|
import { datasetUrlByUrn } from '@datahub/data-models/api/dataset/dataset';
|
|
import { isNotFoundApiError } from '@datahub/utils/api/shared';
|
|
|
|
const datasetGroupsByUrn = (urn: string): string => `${datasetUrlByUrn(urn)}/groups`;
|
|
|
|
/**
|
|
* Fetches the dataset groups from the mid tier for the given URN
|
|
* @param {string} urn The URN of the dataset
|
|
* @return {Promise<Array<{urn:string}>}
|
|
*/
|
|
export const readDatasetGroups = (urn: string): Promise<Array<{ urn: string }>> => {
|
|
try {
|
|
return getJSON({ url: datasetGroupsByUrn(urn) });
|
|
} catch (e) {
|
|
// In the case a 404 is encountered. We return an empty list to the UI , so that the 404 is gracefully handled.
|
|
if (isNotFoundApiError(e)) {
|
|
return Promise.resolve([]);
|
|
}
|
|
throw e;
|
|
}
|
|
};
|