Fetch() GET Requests III - stuck on 4/18


#1

Hello,

I’ve been trying for a while to see what is wrong with my code on module 12 (Requests II) of the JavaScript course but can’t identify the issue, so would be grateful for your enlightened eyes!

I can’t seem to get past the last step of chaining a then. method to another then. method when using the fetch() function to create a GET request.

fetch('https://api-to-call.com/endpoint').then(function success(response) {
  if(response.ok) {
    return response.json();
  }
    throw new Error ('Request failed!');
},
	function failure(networkError) {
  	console.log(networkError.message)
			};
).then(jsonResponse => jsonResponse);

#2

This topic was automatically closed after 7 days. New replies are no longer allowed.