Skip to content

Commit fd1f8ec

Browse files
author
pooya parsa
committed
fix(plugin): use globalName instead of $nuxt (fixes #345)
1 parent 7dec0a0 commit fd1f8ec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/plugin.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import Axios from 'axios'
22
import defu from 'defu'
33
<% if (options.retry) { %>import axiosRetry from 'axios-retry'<% } %>
44

5+
const globalName = '<%= globalName %>'
6+
57
// Axios.prototype cannot be modified
68
const axiosExtra = {
79
setBaseURL (baseURL) {
@@ -126,7 +128,7 @@ const setupProgress = (axios) => {
126128
set: () => { }
127129
}
128130

129-
const $loading = () => (window.$nuxt && window.$nuxt.$loading && window.$nuxt.$loading.set) ? window.$nuxt.$loading : noopLoading
131+
const $loading = () => (window[globalName] && window[globalName].$loading && window[globalName].$loading.set) ? window[globalName].$loading : noopLoading
130132

131133
let currentRequests = 0
132134

0 commit comments

Comments
 (0)