feat: add keys & bucket permissions management

This commit is contained in:
2024-08-16 23:10:19 +07:00
parent dfb4e30e23
commit 43af9c8658
30 changed files with 948 additions and 53 deletions
+3 -1
View File
@@ -29,7 +29,9 @@ const api = {
});
if (!res.ok) {
throw new Error(res.statusText);
const json = await res.json().catch(() => {});
const message = json?.message || res.statusText;
throw new Error(message);
}
const isJson = res.headers
+1 -2
View File
@@ -14,8 +14,7 @@ export const readableBytes = (bytes?: number | null, divider = 1024) => {
if (bytes == null || Number.isNaN(bytes)) return "n/a";
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
if (bytes === 0) return "n/a";
const i = Math.floor(Math.log(bytes) / Math.log(divider));
const i = Math.max(0, Math.floor(Math.log(bytes) / Math.log(divider)));
return `${(bytes / Math.pow(divider, i)).toFixed(1)} ${sizes[i]}`;
};