mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-03 20:27:50 +00:00
updates api readers for platforms and compliance Data types. adds link for purge policies
This commit is contained in:
parent
cec37f49e6
commit
43f40cd4f1
@ -2,6 +2,17 @@
|
||||
<header class="metadata-prompt__header">
|
||||
<p>
|
||||
Compliance Purge Policy
|
||||
|
||||
<a
|
||||
target="_blank"
|
||||
href="http://go/gdpr/deletions/purgePolicies">
|
||||
<sup>
|
||||
More Info
|
||||
|
||||
<span class="glyphicon glyphicon-question-sign"
|
||||
title="More information Purge Policies"></span>
|
||||
</sup>
|
||||
</a>
|
||||
</p>
|
||||
</header>
|
||||
</section>
|
||||
|
||||
@ -29,7 +29,5 @@ export interface IComplianceDataType {
|
||||
* @interface IComplianceDataTypeResponse
|
||||
*/
|
||||
export interface IComplianceDataTypeResponse {
|
||||
status: ApiStatus;
|
||||
complianceDataTypes?: Array<IComplianceDataType>;
|
||||
msg?: string;
|
||||
}
|
||||
|
||||
@ -21,10 +21,6 @@ export interface IDataPlatform {
|
||||
* @interface IPlatformsResponse
|
||||
*/
|
||||
export interface IPlatformsResponse {
|
||||
// Response status
|
||||
status: ApiStatus;
|
||||
// optional platforms property containing the list of platforms
|
||||
platforms?: Array<IDataPlatform>;
|
||||
// optional api error message
|
||||
msg?: string;
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { IComplianceDataType, IComplianceDataTypeResponse } from 'wherehows-web/typings/api/list/compliance-datatypes';
|
||||
import { ApiStatus } from 'wherehows-web/utils/api';
|
||||
import { getJSON } from 'wherehows-web/utils/api/fetcher';
|
||||
import { getListUrlRoot } from 'wherehows-web/utils/api/list/shared';
|
||||
|
||||
@ -14,15 +13,11 @@ const complianceDataTypesUrl = `${getListUrlRoot('v2')}/complianceDataTypes`;
|
||||
* @returns {Promise<Array<IComplianceDataType>>}
|
||||
*/
|
||||
const readComplianceDataTypes = async (): Promise<Array<IComplianceDataType>> => {
|
||||
const { status, complianceDataTypes = [], msg } = await getJSON<IComplianceDataTypeResponse>({
|
||||
const { complianceDataTypes = [] } = await getJSON<IComplianceDataTypeResponse>({
|
||||
url: complianceDataTypesUrl
|
||||
});
|
||||
|
||||
if (status === ApiStatus.OK && complianceDataTypes.length) {
|
||||
return complianceDataTypes;
|
||||
}
|
||||
|
||||
throw new Error(msg);
|
||||
};
|
||||
|
||||
export { readComplianceDataTypes };
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { IPlatformsResponse, IDataPlatform } from 'wherehows-web/typings/api/list/platforms';
|
||||
import { ApiStatus } from 'wherehows-web/utils/api';
|
||||
import { getJSON } from 'wherehows-web/utils/api/fetcher';
|
||||
import { getListUrlRoot } from 'wherehows-web/utils/api/list/shared';
|
||||
|
||||
@ -13,17 +12,9 @@ const platformsUrl = `${getListUrlRoot('v2')}/platforms`;
|
||||
* @returns {Promise<Array<IDataPlatform>>}
|
||||
*/
|
||||
const readPlatforms = async (): Promise<Array<IDataPlatform>> => {
|
||||
const { status, platforms = [], msg } = await getJSON<IPlatformsResponse>({ url: platformsUrl });
|
||||
|
||||
if (status === ApiStatus.OK) {
|
||||
if (!platforms.length) {
|
||||
throw new Error('No platforms found');
|
||||
}
|
||||
const { platforms = [] } = await getJSON<IPlatformsResponse>({ url: platformsUrl });
|
||||
|
||||
return platforms;
|
||||
}
|
||||
|
||||
throw new Error(msg);
|
||||
};
|
||||
|
||||
export { readPlatforms };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user