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.9.7
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.0
Choose a head ref
  • 11 commits
  • 14 files changed
  • 6 contributors

Commits on Apr 16, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    990cfb7 View commit details

Commits on Apr 20, 2020

  1. Vue School links (#352)

    * docs: add link to Axios Module lesson
    
    * Update readme.md
    
    Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
    rahaug and atinux authored Apr 20, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    crazy-max CrazyMax
    Copy the full SHA
    509e43f View commit details

Commits on Apr 21, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d6b1043 View commit details
  2. chore(deps): update all non-major dependencies (#350)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Apr 21, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a9d3e55 View commit details
  3. chore: update yarn.lock

    pooya parsa committed Apr 21, 2020
    Copy the full SHA
    7dec0a0 View commit details
  4. fix(plugin): use globalName instead of $nuxt (fixes #345)

    pooya parsa committed Apr 21, 2020
    Copy the full SHA
    fd1f8ec View commit details
  5. fix(plugin): preserve default headers (fixes #323)

    pooya parsa committed Apr 21, 2020
    Copy the full SHA
    6c5605d View commit details
  6. fix(module): browserBaseURL as empty string (fixes #303)

    pooya parsa committed Apr 21, 2020
    Copy the full SHA
    18afe5c View commit details
  7. Copy the full SHA
    074f98c View commit details
  8. test: remove brotli test

    pooya parsa committed Apr 21, 2020
    Copy the full SHA
    8be99d1 View commit details
  9. chore(release): 5.10.0

    pooya parsa committed Apr 21, 2020
    Copy the full SHA
    86d16cf View commit details
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,20 @@

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.0](https://github.com/nuxt-community/axios-module/compare/v5.9.7...v5.10.0) (2020-04-21)


### Features

* **plugin:** enable server brotli if supported (closes [#276](https://github.com/nuxt-community/axios-module/issues/276)) ([074f98c](https://github.com/nuxt-community/axios-module/commit/074f98cbdf409473357b2cd24cd6cb13fe75f149))


### Bug Fixes

* **module:** browserBaseURL as empty string (fixes [#303](https://github.com/nuxt-community/axios-module/issues/303)) ([18afe5c](https://github.com/nuxt-community/axios-module/commit/18afe5c1a9aac6380bdd5ffb337a0968a6d504aa))
* **plugin:** preserve default headers (fixes [#323](https://github.com/nuxt-community/axios-module/issues/323)) ([6c5605d](https://github.com/nuxt-community/axios-module/commit/6c5605df0b77e9e4df32ad1eaecb2eac60eb1c1d))
* **plugin:** use `globalName` instead of `$nuxt` (fixes [#345](https://github.com/nuxt-community/axios-module/issues/345)) ([fd1f8ec](https://github.com/nuxt-community/axios-module/commit/fd1f8ec17160f6e88610e3dfa2153423b3140592))

### [5.9.7](https://github.com/nuxt-community/axios-module/compare/v5.9.6...v5.9.7) (2020-03-30)


1 change: 1 addition & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
title: 'Axios Module',
description: 'Axios Module for Nuxt',
head: [['link', { rel: 'stylesheet', href: '/styles.css' }]],
themeConfig: {
repo: 'nuxt-community/axios-module',
docsDir: 'docs',
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.vuepress/public/async-data-with-nuxtjs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions docs/.vuepress/public/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
.Promote {
background-color: #edf2f7;
color: #2f495e;
display: flex;
flex-direction: column;
padding: 1rem;
margin-top: 1rem;
margin-bottom: 1rem;
border-radius: .25rem;
}


.Promote:hover {
background-color: #e2e8f0 !important;
text-decoration: none !important;
}

.Promote img {
width: 100%;
height: auto;
border-radius: .25rem;
margin-bottom: .75rem;
}

.Promote .Promote__Content {
font-size: 0.75rem;
margin: 0;
padding: 0;
font-weight: 500;
}

.Promote .Promote__Content__Title {
font-size: 1.25rem;
color: #2f495e;
font-weight: 500;
margin-top: 1rem;
margin-bottom: 0;
}

.Promote .Promote__Content__Description {
line-height: 1.625;
font-size: .875rem;
color: #606f7b;
}

.Promote .Promote__Content__Signature {
color: #a0aec0;
font-size: .75rem;
margin: 0;
line-height: 1;
}

@media screen and (min-width: 1020px) {

.Promote {
flex-direction: row;
}

.Promote .Promote__Content {
padding-left: 1rem;
}


.Promote .Promote__Content__Title {
margin: 0;
}

.Promote img {
max-width: 240px !important;
margin-bottom: 0;
}

}

2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -5,6 +5,6 @@
"build": "vuepress build"
},
"devDependencies": {
"vuepress": "^1.4.0"
"vuepress": "^1.4.1"
}
}
13 changes: 13 additions & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
@@ -28,3 +28,16 @@
* [Examples](https://axios.nuxtjs.org/usage.html)

> 👉 To get started head to [Setup](setup.md) section.
## Online courses

<div>
<a href="https://vueschool.io/lessons/the-axios-module?friend=nuxt" target="_blank" class="Promote">
<img src="/async-data-with-nuxtjs-2x.png" alt="AsyncData Nuxt course by Vue School"/>
<div class="Promote__Content">
<h4 class="Promote__Content__Title">Learn how to use the Axios module with a short video lesson</h4>
<p class="Promote__Content__Description">Get up to speed quickly with Vue School's free video lesson.</p>
<p class="Promote__Content__Signature">Video courses made by VueSchool to support Nuxt.js developpement.</p>
</div>
</a>
</div>
6 changes: 3 additions & 3 deletions docs/setup.md
Original file line number Diff line number Diff line change
@@ -30,17 +30,17 @@ module.exports = {
```


## Typescript
## TypeScript

Add the types to your "types" array in tsconfig.json after the `@nuxt/vue-app` entry
Add the types to your "types" array in tsconfig.json after the `@nuxt/types` (Nuxt 2.9.0+) or `@nuxt/vue-app` entry

**tsconfig.json**

```json
{
"compilerOptions": {
"types": [
"@nuxt/vue-app",
"@nuxt/types",
"@nuxtjs/axios"
]
}
114 changes: 57 additions & 57 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
@@ -953,18 +953,18 @@
source-map "~0.6.1"
vue-template-es2015-compiler "^1.9.0"

"@vuepress/core@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@vuepress/core/-/core-1.4.0.tgz#a9b09a2615b1f0bf183541d22e69a126b8220f16"
integrity sha512-xWiLG6MEzZdXGvr7/ickSr/plxPESC8c3prMOUDxROkFnyOiKmVvIyn4vAmRkFX3Xw4mfOLxucIOpQg0K6hEjw==
"@vuepress/core@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@vuepress/core/-/core-1.4.1.tgz#b6f75720d9b7132b90cce46f620bcdda5d07e581"
integrity sha512-R1oJeSiDQPw8sVo70mrP1Zn2H0nCqnAHb6DV9mpJBQ6ur4VT6qQnCpd2onKU+bZRLlEhm4G8IQNDEV+DuE7zZQ==
dependencies:
"@babel/core" "^7.8.4"
"@vue/babel-preset-app" "^4.1.2"
"@vuepress/markdown" "^1.4.0"
"@vuepress/markdown-loader" "^1.4.0"
"@vuepress/plugin-last-updated" "^1.4.0"
"@vuepress/plugin-register-components" "^1.4.0"
"@vuepress/shared-utils" "^1.4.0"
"@vuepress/markdown" "1.4.1"
"@vuepress/markdown-loader" "1.4.1"
"@vuepress/plugin-last-updated" "1.4.1"
"@vuepress/plugin-register-components" "1.4.1"
"@vuepress/shared-utils" "1.4.1"
autoprefixer "^9.5.1"
babel-loader "^8.0.4"
cache-loader "^3.0.0"
@@ -997,65 +997,65 @@
webpack-merge "^4.1.2"
webpackbar "3.2.0"

"@vuepress/markdown-loader@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@vuepress/markdown-loader/-/markdown-loader-1.4.0.tgz#974e9bdb62ad45c1614a6c3ef33eed276d27635a"
integrity sha512-oEHB6EzCeIxyQxg1HSGX3snRL25V6XZ3O0Zx/sWd5hl0sneEsRLHRMflPGhKu4c6cfsyTck7aTbt7Z71vVy0FQ==
"@vuepress/markdown-loader@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@vuepress/markdown-loader/-/markdown-loader-1.4.1.tgz#7a97772ed5238c68eb1ab2921fc5ced21ff7e18e"
integrity sha512-FGtZ15rRwo9iVMcJ0eX4tf1bxWSKKpC4NGNLJuYzaPlO9ND/U04jsj4Xj454piokr2JzBSmaJlIZTAG1EuiTNw==
dependencies:
"@vuepress/markdown" "^1.4.0"
"@vuepress/markdown" "1.4.1"
loader-utils "^1.1.0"
lru-cache "^5.1.1"

"@vuepress/markdown@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@vuepress/markdown/-/markdown-1.4.0.tgz#fe96e0c07ae3ce7562c21ea6f5ea4a5359ba4ea9"
integrity sha512-H3uojkiO5/uWKpwBEPdk5fsSj+ZGgNR7xi6oYhUxaUak9nC6mhMZ3KzeNA67QmevG3XHEoYx4d9oeAC1Au1frg==
"@vuepress/markdown@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@vuepress/markdown/-/markdown-1.4.1.tgz#cc507ce4a3447dfc459082105cb83909db4b54f1"
integrity sha512-5a69ufnu1A3NXqQtzAE5LiR7EbtsQ1qe8UcIr+KizNO4gCg8+E8/uu3hxvDOLs2ElS6b0AihKIuwmeIgZkfeKA==
dependencies:
"@vuepress/shared-utils" "^1.4.0"
"@vuepress/shared-utils" "1.4.1"
markdown-it "^8.4.1"
markdown-it-anchor "^5.0.2"
markdown-it-chain "^1.3.0"
markdown-it-emoji "^1.4.0"
markdown-it-table-of-contents "^0.4.0"
prismjs "^1.13.0"

"@vuepress/plugin-active-header-links@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-active-header-links/-/plugin-active-header-links-1.4.0.tgz#b43fdad67ef42c383a84642f7914e22c56189089"
integrity sha512-UWnRcqJZnX1LaPHxESx4XkRVJCleWvdGlSVivRGNLZuV1xrxJzB6LC86SNMur+imoyzeQL/oIgKY1QFx710g8w==
"@vuepress/plugin-active-header-links@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-active-header-links/-/plugin-active-header-links-1.4.1.tgz#36c6952230f12056d18c63229e0e499c6ef74fe5"
integrity sha512-xv/qDY6S8rHzLGDHtwn3XV7Gi3Fnevp6d3H18PFK3sNwT2KGzKIe2c7lbn1qHDRUWcxY7+EoT7zmdJwIeG6dWQ==
dependencies:
lodash.debounce "^4.0.8"

"@vuepress/plugin-last-updated@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-last-updated/-/plugin-last-updated-1.4.0.tgz#1657eee410ff5a7431b2a8e88d19e7e44bdc3951"
integrity sha512-sNxCXDz7AO4yIAZTEGt9TaLpJ2E0dgJGWx79nDFKfvpITn+Q2p7dUzkyVVxXs3TWXffoElGdNj/xIL5AUkg2qg==
"@vuepress/plugin-last-updated@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-last-updated/-/plugin-last-updated-1.4.1.tgz#89a9a4cbc242f9e0c5d380f73edb85ac4a7186c6"
integrity sha512-67ouc9cB3C19zcDqeJwhwqO9CXjy8G67tcXUgPpL/GsuK11oQbnR4rkupILvNa9HoemtCcF2aaxXSGsi/1VEtA==
dependencies:
cross-spawn "^6.0.5"

"@vuepress/plugin-nprogress@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-nprogress/-/plugin-nprogress-1.4.0.tgz#90bb16ab8d43321e5911dea489986de25adb56d1"
integrity sha512-hJ9phJHONWWZqcWztbVtmmRjZduHQHIOBifUBvAfAGcuOBLVHqRnv3i7XD5UB3MIWPM1/bAoTA2TVs4sb9Wg4Q==
"@vuepress/plugin-nprogress@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-nprogress/-/plugin-nprogress-1.4.1.tgz#2a16217091102a2b4fddc1b09f5854ac4f80f992"
integrity sha512-CIhIuIgKtvk/ULENjefkZAJQqUstdZcqiM/Gs8CDyTKJITpwyqoZcgolFZ+1ZofUQuHuqDj1hKKm3AQ1cG3cBA==
dependencies:
nprogress "^0.2.0"

"@vuepress/plugin-register-components@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-register-components/-/plugin-register-components-1.4.0.tgz#0dafefd3baed6cc50b53f9826e84b25d83fed763"
integrity sha512-HmSzCTPVrlJJ8PSIXAvh4RkPy9bGmdrQuAXAtjiiq5rzBjL3uIg2VwzTrKDqf7FkCKs4lcRAEuNxB70bH6tddA==
"@vuepress/plugin-register-components@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-register-components/-/plugin-register-components-1.4.1.tgz#25d70834006960f54475da97255ebaca66ecc5a6"
integrity sha512-6yI4J/tMhOASSLmlP+5p4ccljlWuNBRsyYSKiD5jWAV181oMmN32LtuoCggXBhSvQUgn2grxyjmYw+tcSV5KGQ==
dependencies:
"@vuepress/shared-utils" "^1.4.0"
"@vuepress/shared-utils" "1.4.1"

"@vuepress/plugin-search@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-search/-/plugin-search-1.4.0.tgz#26a02e3409e6ea6830f9fc7e6d87fc45ba46c579"
integrity sha512-5K02DL9Wqlfy/aNiYXdbXBOGzR9zMNKz/P8lfHDU+ZOjtfNf6ImAdUkHS4pi70YkkTuemdYM8JjG/j5UYn6Rjw==
"@vuepress/plugin-search@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@vuepress/plugin-search/-/plugin-search-1.4.1.tgz#5842f7ef0214c8f9f3cafa6ca2f4648f8dbc03d2"
integrity sha512-J4JyXD6M1oOU013s4ZLKMkKEGd7qEtSIsAw2nZY2mckZ7ETX49R5Pv2S5uCqLRQfUQSIGR5TEABL22q0B8uCVA==

"@vuepress/shared-utils@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@vuepress/shared-utils/-/shared-utils-1.4.0.tgz#ab4bfcd5c1e3d0e5e384e0c1d0bb86470430c87e"
integrity sha512-6QTv7zMRXAojCuPRIm4aosYfrQO4OREhyxvbFeg/ZMWkVX+xZZQTdE7ZyK/4NAvEgkpjtPTRC1TQYhLJUqC5mQ==
"@vuepress/shared-utils@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@vuepress/shared-utils/-/shared-utils-1.4.1.tgz#d09fcd742111f2efeef93b9c9b353bcd8202ae97"
integrity sha512-FBUHFhvR7vk6glQy/qUntBz8bVeWiNYZ2/G16EKaerKKn15xAiD7tUFCQ3L/KjtQJ8TV38GK47UEXh7UTcRwQg==
dependencies:
chalk "^2.3.2"
diacritics "^1.3.0"
@@ -1067,14 +1067,14 @@
semver "^6.0.0"
upath "^1.1.0"

"@vuepress/theme-default@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@vuepress/theme-default/-/theme-default-1.4.0.tgz#f0f70effa0ee863a2e25c7682612c8a808f3e156"
integrity sha512-4ywWVfXZTBha+yuvWoa1HRg0vMpT2wZF3zuW0PDXkDzxqP4DkLljJk8mPpepyuPYlSThn+gHNC8kmnNBbGp3Tw==
"@vuepress/theme-default@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@vuepress/theme-default/-/theme-default-1.4.1.tgz#8a0ddc51bee6f3c3b93fae059cac76fe63c51db3"
integrity sha512-QhU1ORj20xmGr9Gk5szWJyzHm8i+NqxotBTeOF4WsKewB/3SPamJUoipgX4VdChw9jVew1oJQw0TpyDZfiHx+A==
dependencies:
"@vuepress/plugin-active-header-links" "^1.4.0"
"@vuepress/plugin-nprogress" "^1.4.0"
"@vuepress/plugin-search" "^1.4.0"
"@vuepress/plugin-active-header-links" "1.4.1"
"@vuepress/plugin-nprogress" "1.4.1"
"@vuepress/plugin-search" "1.4.1"
docsearch.js "^2.5.2"
lodash "^4.17.15"
stylus "^0.54.5"
@@ -7418,13 +7418,13 @@ vuepress-plugin-smooth-scroll@^0.0.3:
dependencies:
smoothscroll-polyfill "^0.4.3"

vuepress@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/vuepress/-/vuepress-1.4.0.tgz#308037b15baec6e251b835fe1fff7da507302b6b"
integrity sha512-VrBNCCjyrB4EfdIRWTW6uo/xmMzplVsGE/2oGLkgVhWLPCvvSEAcGQhoUKWxRJXk6CdrDCov6jsmu6MA1N3fvw==
vuepress@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/vuepress/-/vuepress-1.4.1.tgz#726885da5c569755b40fd795ef3aed3fae13f83c"
integrity sha512-vFePZLEx9FRJf5buDqSSBHHbTrPzBsL1u3Z4LX0HI9iQmHjkP+cGA8MMS0zVYy/xyYf28xWLWo3L/gj0rdMy7w==
dependencies:
"@vuepress/core" "^1.4.0"
"@vuepress/theme-default" "^1.4.0"
"@vuepress/core" "1.4.1"
"@vuepress/theme-default" "1.4.1"
cac "^6.5.6"
envinfo "^7.2.0"
opencollective-postinstall "^2.0.2"
4 changes: 2 additions & 2 deletions lib/module.js
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ function axiosModule (_moduleOptions) {
// Apply defaults
const options = defu(moduleOptions, {
baseURL: `http://${defaultHost}:${defaultPort}${prefix}`,
browserBaseURL: null,
browserBaseURL: undefined,
credentials: false,
debug: false,
progress: true,
@@ -78,7 +78,7 @@ function axiosModule (_moduleOptions) {
}

// Default browserBaseURL
if (!options.browserBaseURL) {
if (typeof options.browserBaseURL === 'undefined') {
options.browserBaseURL = options.proxy ? prefix : options.baseURL
}

26 changes: 20 additions & 6 deletions lib/plugin.js
Original file line number Diff line number Diff line change
@@ -2,6 +2,15 @@ import Axios from 'axios'
import defu from 'defu'
<% if (options.retry) { %>import axiosRetry from 'axios-retry'<% } %>

const globalName = '<%= globalName %>'

// Check Node.js brotli support
let brotliSupported
if (process.server) {
const zlib = require('zlib')
brotliSupported = typeof zlib.createBrotliDecompress == 'function'
}

// Axios.prototype cannot be modified
const axiosExtra = {
setBaseURL (baseURL) {
@@ -126,7 +135,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

@@ -195,12 +204,17 @@ export default (ctx, inject) => {

<% if (options.proxyHeaders) { %>
// Proxy SSR request headers headers
axiosOptions.headers.common = (ctx.req && ctx.req.headers) ? Object.assign({}, ctx.req.headers) : {}
<% for (let h of options.proxyHeadersIgnore) { %>delete axiosOptions.headers.common['<%= h %>']
<% } %><% } %>
if (process.server && ctx.req && ctx.req.headers) {
const reqHeaders = { ...ctx.req.headers }
for (let h of <%= serialize(options.proxyHeadersIgnore) %>) {
delete reqHeaders[h]
}
axiosOptions.headers.common = { ...reqHeaders, ...axiosOptions.headers.common }
}
<% } %>

if (process.server) {
// Don't accept brotli encoding because Node can't parse it
// Don't accept brotli encoding because Node can't parse it
if (process.server && !brotliSupported) {
axiosOptions.headers.common['accept-encoding'] = 'gzip, deflate'
}

Loading