first commit

This commit is contained in:
Raul Lugo
2024-12-25 20:30:57 +01:00
commit 6ef22531bb
165 changed files with 53426 additions and 0 deletions

22
dist/script/utils.js vendored Normal file
View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleResponse = exports.toBlob = void 0;
const errors_js_1 = require("./types/errors.js");
function toBlob(content) {
if (content instanceof Blob)
return content;
return new Blob([content]);
}
exports.toBlob = toBlob;
async function handleResponse(response) {
if (!response.ok) {
const errorData = await response.json().catch(() => ({
message: response.statusText,
status: `${response.status}`,
}));
throw new errors_js_1.ValidationError(errorData.message || "Unknown error", response.status);
}
const data = await response.json();
return data;
}
exports.handleResponse = handleResponse;