use object spread (#216)

master
Ricardo Gobbo de Souza 2019-02-19 05:43:56 -03:00 committed by Pooya Parsa
parent e8b8df3284
commit 932abc071b
1 changed files with 14 additions and 16 deletions

View File

@ -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 =
@ -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