ez-api-wrapper
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -66,9 +66,9 @@ const axios = require('axios'); | ||
try { | ||
const response = await axios.get(`${apiUrl}/posts`); | ||
return response.data; | ||
const response = await axios.get(`${apiUrl}/posts`); | ||
return response.data; | ||
} catch (error) { | ||
throw new Error(`Error fetching posts: ${error.message}`); | ||
throw new Error(`Error fetching posts: ${error.message}`); | ||
} | ||
} | ||
} | ||
// Function to fetch users from the API | ||
@@ -80,6 +80,3 @@ async function fetchUsers(apiUrl) { | ||
const users = await axios.get(`${apiUrl}/users`); | ||
return users.data; | ||
// If an error occurs during the request, throw an error | ||
} catch (error) { | ||
@@ -89,2 +86,3 @@ throw new Error('Error fetching users: Network Error'); | ||
} | ||
module.exports = { | ||
@@ -95,3 +93,3 @@ fetchData, | ||
fetchUsers, | ||
}; | ||
emitter: emitter // Expose emitter for event handling | ||
}; |
{ | ||
"name": "ez-api-wrapper", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Wrapper for an API: If there's an API you frequently use, you could create a wrapper for it that simplifies the process of making requests and handling responses. This could be for anything from weather data to social media APIs.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
203
49893