Closed divakar54 closed 3 years ago
@divakar54 I think the issue is because the request being fired is http://pets-v2.dev-apis.com/breeds?animal=${animal} as opposed to http://pets-v2.dev-apis.com/breeds?animal=dog This is because the template string has not been replaced ${animal} . Are you using the template literal `
const res = await fetch(`http://pets-v2.dev-apis.com/breeds?animal=${animal}`);
I am using the template literal, but the problem got solved anyway. I was doing a small mistake somewhere else, the url works fine.
I am unable to fetch breeds data from the Pets api. const res = await fetch(
http://pets-v2.dev-apis.com/breeds?animal=${animal}
); the above line returns, { "animal": "${animal}" }