NuxtN
Nuxt12mo ago
jbrundagejr

dynamic route getRouterParams not updated

Hey all! I have a server setup like so in the attached screenshot. When I call getRouterParam and use the string slug, the value comes back as
undefined
but when I use the string
id
it works. I had previously had the file called
id
but realized that wasn't accurate so I updated it. Has anyone hit this before? Is it that the file name won't update the Nuxt API? It's working so not a big issue, but I'd like to make sure my code is readable. this is how I'm using it now:
const slug = getRouterParam(event, "id")
but I'm pretty sure it should be
const slug = getRouterParam(event, "slug")
since the file is now [slug].get.ts. Thanks in advance!
Screenshot_2025-01-08_at_12.07.37_PM.png
Was this page helpful?