Skip to content

Commit 4942979

Browse files
authored
refactor(plugin): use const for non-reassigned variables (#406)
1 parent 18c9735 commit 4942979

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/plugin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const axiosExtra = {
88
this.defaults.baseURL = baseURL
99
},
1010
setHeader (name, value, scopes = 'common') {
11-
for (let scope of Array.isArray(scopes) ? scopes : [ scopes ]) {
11+
for (const scope of Array.isArray(scopes) ? scopes : [ scopes ]) {
1212
if (!value) {
1313
delete this.defaults.headers[scope][name];
1414
return
@@ -42,12 +42,12 @@ const axiosExtra = {
4242
}
4343

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

4949
const extendAxiosInstance = axios => {
50-
for (let key in axiosExtra) {
50+
for (const key in axiosExtra) {
5151
axios[key] = axiosExtra[key].bind(axios)
5252
}
5353
}
@@ -206,7 +206,7 @@ export default (ctx, inject) => {
206206
// Proxy SSR request headers headers
207207
if (process.server && ctx.req && ctx.req.headers) {
208208
const reqHeaders = { ...ctx.req.headers }
209-
for (let h of <%= serialize(options.proxyHeadersIgnore) %>) {
209+
for (const h of <%= serialize(options.proxyHeadersIgnore) %>) {
210210
delete reqHeaders[h]
211211
}
212212
axiosOptions.headers.common = { ...reqHeaders, ...axiosOptions.headers.common }

0 commit comments

Comments
 (0)