Nuxt Async Data not showing return data

Do you see this .then(querySnapshot => { ?

You are returning your result to an callback function. Rewrite it like this

async asyncData({ params }) {
    console.log("params ...");
    console.log(params.id);
    let asyncDataDescription = "";
    let querySnapshot = await firebase
      .firestore()
      .collection("posts")
      .where("ytid", "==", params.id)
      .get()
    querySnapshot.forEach(doc => {
       asyncDataDescription = doc.data().ytDescription;
    });
    console.log("description fdkjfdk");
    console.log(asyncDataDescription);
    return { aSyncDescription: asyncDataDescription };
  },

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top