Skip to content

Commit

Permalink
refactor(plugin): use const for non-reassigned variables (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
same31 committed Aug 21, 2020
1 parent 18c9735 commit 4942979
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const axiosExtra = {
this.defaults.baseURL = baseURL
},
setHeader (name, value, scopes = 'common') {
for (let scope of Array.isArray(scopes) ? scopes : [ scopes ]) {
for (const scope of Array.isArray(scopes) ? scopes : [ scopes ]) {
if (!value) {
delete this.defaults.headers[scope][name];
return
Expand Down Expand Up @@ -42,12 +42,12 @@ const axiosExtra = {
}

// Request helpers ($get, $post, ...)
for (let method of ['request', 'delete', 'get', 'head', 'options', 'post', 'put', 'patch']) {
for (const method of ['request', 'delete', 'get', 'head', 'options', 'post', 'put', 'patch']) {
axiosExtra['$' + method] = function () { return this[method].apply(this, arguments).then(res => res && res.data) }
}

const extendAxiosInstance = axios => {
for (let key in axiosExtra) {
for (const key in axiosExtra) {
axios[key] = axiosExtra[key].bind(axios)
}
}
Expand Down Expand Up @@ -206,7 +206,7 @@ export default (ctx, inject) => {
// Proxy SSR request headers headers
if (process.server && ctx.req && ctx.req.headers) {
const reqHeaders = { ...ctx.req.headers }
for (let h of <%= serialize(options.proxyHeadersIgnore) %>) {
for (const h of <%= serialize(options.proxyHeadersIgnore) %>) {
delete reqHeaders[h]
}
axiosOptions.headers.common = { ...reqHeaders, ...axiosOptions.headers.common }
Expand Down

0 comments on commit 4942979

Please sign in to comment.