[ui] add fetchEntity once fn

feat/vaults
Tomáš Mládek 2022-02-12 23:22:23 +01:00
parent e8de358966
commit 205ca7758b
No known key found for this signature in database
GPG Key ID: 65E225C8B3E2ED8A
1 changed files with 7 additions and 0 deletions

View File

@ -51,6 +51,13 @@ export function useEntity(address: string) {
};
}
export async function fetchEntity(address: string): Promise<UpObject> {
const entityFetch = await fetch(`/api/obj/${address}`);
const entityResult = (await entityFetch.json()) as EntityListing;
const entityListing = new UpListing(entityResult.entries);
return entityListing.getObject(address);
}
export async function fetchEntry(address: string) {
const response = await fetch(`api/raw/${address}`);
const data = await response.json();