Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nuxt-community/axios-module
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.10.2
Choose a base ref
...
head repository: nuxt-community/axios-module
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.10.3
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Apr 30, 2020

  1. fix: globalName fallback for nuxt < 2.2.0

    pooya parsa committed Apr 30, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    zhukovgreen zhukovgreen
    Copy the full SHA
    12da6c8 View commit details
  2. chore(release): 5.10.3

    pooya parsa committed Apr 30, 2020
    Copy the full SHA
    0f20c51 View commit details
Showing with 13 additions and 3 deletions.
  1. +7 −0 CHANGELOG.md
  2. +3 −0 lib/module.js
  3. +2 −2 lib/plugin.js
  4. +1 −1 package.json
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [5.10.3](https://github.com/nuxt-community/axios-module/compare/v5.10.2...v5.10.3) (2020-04-30)


### Bug Fixes

* globalName fallback for nuxt < 2.2.0 ([12da6c8](https://github.com/nuxt-community/axios-module/commit/12da6c8e2feb8cf4f7e918fbbe4693400152c1ff))

### [5.10.2](https://github.com/nuxt-community/axios-module/compare/v5.10.1...v5.10.2) (2020-04-27)


3 changes: 3 additions & 0 deletions lib/module.js
Original file line number Diff line number Diff line change
@@ -94,6 +94,9 @@ function axiosModule (_moduleOptions) {
options.browserBaseURL = https(options.browserBaseURL)
}

// globalName
options.globalName = this.nuxt.options.globalName || 'nuxt'

// Register plugin
this.addPlugin({
src: path.resolve(__dirname, 'plugin.js'),
4 changes: 2 additions & 2 deletions lib/plugin.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import Axios from 'axios'
import defu from 'defu'
<% if (options.retry) { %>import axiosRetry from 'axios-retry'<% } %>

const globalName = '$<%= globalName %>'
const $nuxt = typeof window !== 'undefined' && window['$<%= options.globalName %>']

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

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

let currentRequests = 0

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nuxtjs/axios",
"version": "5.10.2",
"version": "5.10.3",
"description": "Secure and easy axios integration with Nuxt.js",
"license": "MIT",
"contributors": [