File size: 848 Bytes
eccc943 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | // Replace these with your actual API endpoints from Postman collection
const API_BASE_URL = 'https://api.example.com';
export const fetchEndpoints = async () => {
try {
const response = await fetch(`${API_BASE_URL}/endpoints`);
if (!response.ok) {
throw new Error('Failed to fetch endpoints');
}
return await response.json();
} catch (error) {
console.error('API Error:', error);
throw error;
}
};
export const fetchEndpointDetails = async (endpointId) => {
try {
const response = await fetch(`${API_BASE_URL}/endpoints/${endpointId}`);
if (!response.ok) {
throw new Error('Failed to fetch endpoint details');
}
return await response.json();
} catch (error) {
console.error('API Error:', error);
throw error;
}
};
// Add more API functions based on your Postman collection |