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,8 +32,7 @@ function axiosModule(_moduleOptions) {
const prefix = process.env.API_PREFIX || moduleOptions.prefix || '/'
// Apply defaults
const options = Object.assign(
{
const options = {
baseURL: `http://${defaultHost}:${defaultPort}${prefix}`,
browserBaseURL: null,
credentials: false,
@ -43,10 +42,9 @@ function axiosModule(_moduleOptions) {
proxyHeadersIgnore: ['accept', 'host', 'cf-ray', 'cf-connecting-ip'],
proxy: false,
retry: false,
https: false
},
moduleOptions
)
https: false,
...moduleOptions
}
// ENV overrides