File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,9 @@ function axiosModule (_moduleOptions) {
94
94
options . browserBaseURL = https ( options . browserBaseURL )
95
95
}
96
96
97
+ // globalName
98
+ options . globalName = this . nuxt . options . globalName || 'nuxt'
99
+
97
100
// Register plugin
98
101
this . addPlugin ( {
99
102
src : path . resolve ( __dirname , 'plugin.js' ) ,
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import Axios from 'axios'
2
2
import defu from 'defu'
3
3
< % if ( options . retry ) { % > import axiosRetry from 'axios-retry' < % } % >
4
4
5
- const globalName = ' $<%= globalName %>'
5
+ const $nuxt = typeof window !== 'undefined' && window [ ' $<%= options. globalName %>']
6
6
7
7
// Axios.prototype cannot be modified
8
8
const axiosExtra = {
@@ -128,7 +128,7 @@ const setupProgress = (axios) => {
128
128
set : ( ) => { }
129
129
}
130
130
131
- const $loading = ( ) => ( window [ globalName ] && window [ globalName ] . $loading && window [ globalName ] . $loading . set ) ? window [ globalName ] . $loading : noopLoading
131
+ const $loading = ( ) => ( $nuxt && $nuxt . $loading && $nuxt . $loading . set ) ? $nuxt . $loading : noopLoading
132
132
133
133
let currentRequests = 0
134
134
You can’t perform that action at this time.
0 commit comments