1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

update retrieveShaclSchema

This commit is contained in:
EnzoVezzaro 2022-09-22 10:23:00 -04:00
parent 009da7b051
commit e83ec6e5f8

View File

@ -140,16 +140,23 @@ export async function retrieveAsset(
}
}
}
let schema: any
export function retrieveShaclSchema(): Promise<ShaclSchema> {
console.log(schema)
if (schema) return schema
export async function retrieveShaclSchema(): Promise<ShaclSchema> {
try {
const response: AxiosResponse<ShaclSchema> = await axios.get(
const getSchema = axios.get(
`${metadataCacheUri}/api/aquarius/validation/schema`
)
if (!response || response.status !== 200 || !response.data) return
const data = { ...response.data }
return data
return getSchema.then((res: any) => {
if (!res || res.status !== 200 || !res.data) return
const data = { ...res.data }
schema = data
return data
})
} catch (error) {
if (axios.isCancel(error)) {
LoggerInstance.log(error.message)