-
Notifications
You must be signed in to change notification settings - Fork 7
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
Segment undefined in the context of a middleware #13
Comments
Hi @sandoche ! Can you provide your configuration ? |
In nuxt.config.js modules: [
// ...
'@dansmaculotte/nuxt-segment'
],
segment: {
writeKey: process.env.SEGMENT_WRITE_KEY,
disabled: false,
useRouter: true
} When I use it in a page in mounted with this.$segment it does work. |
I am using Nuxt.js @ v2.14.7 |
Do you any error logs ? |
When I run a page with this middleware of a layout I have this: No other errors. |
I tried to move the middleware in the page instead of the layout and it's the same |
So it's working in a page but not in a middleware or a layout ? |
Exactly. It works in the mounted of the page. It also works automatically also for each page. It does not work as a middleware (either for the page of the layout) |
Okay, I will try to look at it soon ! |
Thanks for now, I'll run the code on the mounted of the layout, it seems that this works. But I would have a cleaner code by having it in a middleware. |
Hi,
I am trying to use segment from the context, in a middleware loaded from a layout and it does not work.
Segment undefined in the context in a middleware
The text was updated successfully, but these errors were encountered: