Open Luth-Badila opened 2 years ago
'slug' must be defined, why is this still happening even though i have added is empty from lodash ?
Did you solve this?
Making another API call in the Comments
component is unneccessay. while fetching postDetails
you can include the comments and pass it to the Comments
component as prop..
Make the postDetails query like this
query GetPostDetails($slug: String!) {
post(where: {slug: $slug}) {
id
author {
bio
name
photo {
url
}
id
}
createdAt
slug
title
excerpt
featuredImage {
url
}
categories {
name
slug
}
content {
raw
}
comments {
id
name
email
comment
}
}
}
`
How I got rid of this error is by changing the getPostdetails on slug.js from (params) to ({params}). before after
but now i get this error
but now i think that easier to solve , ill give you un update after I solved this one
To get rid of the other errors it was based on me not following the tutorial exactly and making basic mistakes before - getSimilarPosts from sevices/index.js After Added slug and categories Before , more important in my opinion post/slug.js After These undefined issues seem to come from not putting the right parameters so it seems.
'slug' must be defined, why is this still happening even though i have added is empty from lodash ?