Skip to content

Commit

Permalink
use object spread (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogobbosouza authored and pi0 committed Feb 19, 2019
1 parent e8b8df3 commit 932abc0
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const logger = consola.withScope('nuxt:axios')

function axiosModule(_moduleOptions) {
// Combine options
const moduleOptions = Object.assign({}, this.options.axios, _moduleOptions)
const moduleOptions = { ...this.options.axios, ..._moduleOptions }

// Default port
const defaultPort =
Expand All @@ -32,21 +32,19 @@ function axiosModule(_moduleOptions) {
const prefix = process.env.API_PREFIX || moduleOptions.prefix || '/'

// Apply defaults
const options = Object.assign(
{
baseURL: `http://${defaultHost}:${defaultPort}${prefix}`,
browserBaseURL: null,
credentials: false,
debug: false,
progress: true,
proxyHeaders: true,
proxyHeadersIgnore: ['accept', 'host', 'cf-ray', 'cf-connecting-ip'],
proxy: false,
retry: false,
https: false
},
moduleOptions
)
const options = {
baseURL: `http://${defaultHost}:${defaultPort}${prefix}`,
browserBaseURL: null,
credentials: false,
debug: false,
progress: true,
proxyHeaders: true,
proxyHeadersIgnore: ['accept', 'host', 'cf-ray', 'cf-connecting-ip'],
proxy: false,
retry: false,
https: false,
...moduleOptions
}

// ENV overrides

Expand Down

0 comments on commit 932abc0

Please sign in to comment.