Skip to content

Commit 6ace50b

Browse files
author
Pooya Parsa
committed
fix: warn when axios module is not registered
1 parent 4be0d5b commit 6ace50b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020
{
2121
modules: [
2222
'@nuxtjs/auth',
23-
// ...
24-
// Axios module should be included AFTER AUTH
23+
24+
// ...Axios module should be included AFTER @nuxtjs/auth
2525
'@nuxtjs/axios',
26-
// ...
2726
],
2827
auth: {
2928
/* auth options */

templates/auth.plugin.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import authStore from './auth.store'
44
export default async function (ctx, inject) {
55
const { store } = ctx
66

7+
// Check axios module is correctly registered
8+
if (!ctx.$axios) {
9+
/* eslint-disable no-console */
10+
console.error('[@nuxtjs/auth]', 'Please make sure @nuxtjs/axios is added after this module!')
11+
}
12+
713
// Inject $ctx
814
inject('ctx', ctx)
915

0 commit comments

Comments
 (0)