[Vuejs]-Vue3, Fetch API, can't get the usable data

0👍

this has nothing to do with vue. learn more about javascript specifically here Promise:

const getAllPhotos = async () => {
  await fetch("https://jsonplaceholder.typicode.com/photos").then(function (
    response
  ) {
    return response.json();
  });
};

getAllPhotos()
.then(data => console.log(data))

// or

console.log(await getAllPhotos()) // in async function or es 2022

Leave a comment