I am using the PetFinder API, and keep running into a 401 error. I cannot figure out a solution - Any help is appreciated
const [pets, setPets] = useState([]);
const url = "https://api.petfinder.com/v2/animals";
useEffect(() => {
fetch(url, {
method: "GET",
mode: "no-cors",
headers: {
Accept: "application/json",
Authorization: `"Bearer: ${process.env.REACT_APP_access_token}"`,
},
})
.then((res) => res.json())
.then((data) => {
setPets(data);
console.log(pets);
});
}, [pets]);
I am also getting an 'unexpected end of input' error I cannot track down
PetCard.js:8 GET https://api.petfinder.com/v2/animals net::ERR_ABORTED 401
(anonymous) @ PetCard.js:8
c
PetCard.js:8 Uncaught (in promise) SyntaxError: Unexpected end of input (at PetCard.js:8:1)
at PetCard.js:8:1