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

undefined in middleware context #5

Closed
arnasziedavicius opened this issue Sep 13, 2018 · 0 comments · Fixed by #8
Closed

undefined in middleware context #5

arnasziedavicius opened this issue Sep 13, 2018 · 0 comments · Fixed by #8

Comments

@arnasziedavicius
Copy link

arnasziedavicius commented Sep 13, 2018

When in middleware context, app, $moment seems to be undefined. When called in component, however, there seems to be no problem.

nuxt.config.js setup:

module.exports = {
  /*
  ** Modules
  */
  modules: [
    '@nuxtjs/moment',
  ],
  /*
  ** Moment
  */
  moment: {
    locales: ['de'],
    plugin: true,
  },
  /*
  ** Router
  */
  router: {
    middleware: ['test'],
  },
};

Middleware (test.js) code where $moment is undefined:

export default function (context) {
  console.log(context.app.$moment);
}

When does $moment get injected to Vue context and is there something I'm missing?

@manniL manniL mentioned this issue Dec 5, 2018
@pi0 pi0 closed this as completed in #8 Dec 10, 2018
pi0 added a commit that referenced this issue Dec 10, 2018
- Use inject
- Update deps
- Add defaultLocale option

Resolves #6
Resolves #5
Resolves #4
Resolves #3
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

Successfully merging a pull request may close this issue.

1 participant