poe-api-manager
Version:
poe.ninja and poe.watch API
27 lines (26 loc) • 834 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = __importDefault(require("axios"));
/**
* Fetches data from the provided URL using Axios.
* @param url The URL to fetch data from.
* @returns A Promise that resolves with the fetched data.
* @throws If an error occurs during the fetch process.
*/
async function fetchData(url) {
try {
const response = await axios_1.default.get(url, {
headers: {
'Accept-Encoding': 'identity',
},
});
return response;
}
catch (error) {
throw new Error(`Error fetching data: ${error.message}`);
}
}
exports.default = fetchData;