Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slug must be defined #35

Open
Luth-Badila opened this issue Jul 5, 2022 · 3 comments
Open

Slug must be defined #35

Luth-Badila opened this issue Jul 5, 2022 · 3 comments

Comments

@Luth-Badila
Copy link

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

@Hoxtygen
Copy link

Hoxtygen commented Oct 9, 2022

'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
        }

    }
	}
	`


@olamission
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants