@lighthouse-web3/sdk
Version:
NPM package and CLI tool to interact with lighthouse protocol
29 lines (28 loc) • 919 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const lighthouse_config_1 = require("../../lighthouse.config");
exports.default = async (authToken, fileId) => {
try {
const response = await fetch(`${lighthouse_config_1.lighthouseConfig.lighthouseAPI}/api/user/delete_file?id=${fileId}`, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${authToken}`,
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`Request failed with status code ${response.status}`);
}
const result = (await response.json());
/*
Example response:
{
"message": "File deleted successfully."
}
*/
return { data: result };
}
catch (error) {
throw new Error(error.message);
}
};