susanBuck / e28-spring20

0 stars 0 forks source link

Week 10 - Error on Product Page #55

Closed guyewhite closed 4 years ago

guyewhite commented 4 years ago

Hi Team,

For some reason, I cannot get my individual product page to show. I've gone through the Week 10 Part 3 video 3 times and still end up getting the same error.

Would anyone be willing to give me a hand at figuring this out?

Here is my GitHub repository: https://github.com/guyewhite/e28/tree/master/zipfoods

Here is the error I am seeing:

Screen Shot 2020-04-11 at 11 22 16 AM Screen Shot 2020-04-11 at 11 21 12 AM Screen Shot 2020-04-11 at 11 21 22 AM
DoryAzar commented 4 years ago

If you notice the error, the id of the product is not being passed. This is because in the main.js, you need to add « props=true » for the path definition. Otherwise, id won’t be passed as a prop. This should do it.

guyewhite commented 4 years ago

Thank you, @DoryAzar. Is there a way that I could have seen that using the information I posted above? Somehow, I missed that step in the walkthrough.

susanBuck commented 4 years ago

@guyewhite -

With the error you shared, the "red flag" was the URL that was being pinged, and noting that the id portion of the url was undefined:

image

Seeing that narrows down that the id from the route segment/param was not correctly being passed. Then you'd have to do some further deduction to understand why.

For reference, here's the explanation from the notes about setting props:true https://hesweb.dev/e28/notes/vue/vue-router#dynamic-route-matching-with-propstrue

(Covered in Week 9 Part 5 video starting at 32:00)

guyewhite commented 4 years ago

@susanBuck and @DoryAzar Thanks for your help in this.