added /api/info/:id route

This commit is contained in:
Danny Coates 2018-01-30 12:15:09 -08:00
parent 81534d2c13
commit 97ad674be2
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
20 changed files with 74 additions and 38 deletions

View file

@ -53,6 +53,15 @@ export async function setParams(id, owner_token, params) {
return response.ok;
}
export async function fileInfo(id, owner_token) {
const response = await fetch(`/api/info/${id}`, post({ owner_token }));
if (response.ok) {
const obj = await response.json();
return obj;
}
throw new Error(response.status);
}
export async function metadata(id, keychain) {
const result = await fetchWithAuthAndRetry(
`/api/metadata/${id}`,
@ -63,8 +72,6 @@ export async function metadata(id, keychain) {
const data = await result.response.json();
const meta = await keychain.decryptMetadata(b64ToArray(data.metadata));
return {
dtotal: data.dtotal,
dlimit: data.dlimit,
size: data.size,
ttl: data.ttl,
iv: meta.iv,