Skip to content

Commit

Permalink
fix: warn when axios module is not registered
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed Sep 5, 2017
1 parent 4be0d5b commit 6ace50b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
{
modules: [
'@nuxtjs/auth',
// ...
// Axios module should be included AFTER AUTH

// ...Axios module should be included AFTER @nuxtjs/auth
'@nuxtjs/axios',
// ...
],
auth: {
/* auth options */
Expand Down
6 changes: 6 additions & 0 deletions templates/auth.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import authStore from './auth.store'
export default async function (ctx, inject) {
const { store } = ctx

// Check axios module is correctly registered
if (!ctx.$axios) {
/* eslint-disable no-console */
console.error('[@nuxtjs/auth]', 'Please make sure @nuxtjs/axios is added after this module!')
}

// Inject $ctx
inject('ctx', ctx)

Expand Down

0 comments on commit 6ace50b

Please sign in to comment.