project_graphql_blog icon indicating copy to clipboard operation
project_graphql_blog copied to clipboard

Slug must be defined

Open Luth-Badila opened this issue 2 years ago • 3 comments

'slug' must be defined, why is this still happening even though i have added is empty from lodash ? Screenshot_4 Screenshot_5 Screenshot_6

Luth-Badila avatar Jul 05 '22 05:07 Luth-Badila

'slug' must be defined, why is this still happening even though i have added is empty from lodash ? Screenshot_4 Screenshot_5 Screenshot_6

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
        }

    }
	}
	`


Hoxtygen avatar Oct 09 '22 09:10 Hoxtygen

How I got rid of this error is by changing the getPostdetails on slug.js from (params) to ({params}). before image after image

but now i get this error image

but now i think that easier to solve , ill give you un update after I solved this one

olamission avatar Jan 29 '23 03:01 olamission

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 image After image Added slug and categories Before , more important in my opinion post/slug.js image After image These undefined issues seem to come from not putting the right parameters so it seems.

olamission avatar Jan 29 '23 04:01 olamission