Skip to content

Commit

Permalink
fix(plugin): use globalName instead of $nuxt (fixes #345)
Browse files Browse the repository at this point in the history
  • Loading branch information
pooya parsa committed Apr 21, 2020
1 parent 7dec0a0 commit fd1f8ec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import Axios from 'axios'
import defu from 'defu'
<% if (options.retry) { %>import axiosRetry from 'axios-retry'<% } %>

const globalName = '<%= globalName %>'

// Axios.prototype cannot be modified
const axiosExtra = {
setBaseURL (baseURL) {
Expand Down Expand Up @@ -126,7 +128,7 @@ const setupProgress = (axios) => {
set: () => { }
}

const $loading = () => (window.$nuxt && window.$nuxt.$loading && window.$nuxt.$loading.set) ? window.$nuxt.$loading : noopLoading
const $loading = () => (window[globalName] && window[globalName].$loading && window[globalName].$loading.set) ? window[globalName].$loading : noopLoading

let currentRequests = 0

Expand Down

0 comments on commit fd1f8ec

Please sign in to comment.