mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
fix: replace ternary side effect in script (#10931)
Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
@@ -2,7 +2,11 @@ import axios from '../index.js';
|
||||
|
||||
const { GITHUB_TOKEN } = process.env;
|
||||
|
||||
GITHUB_TOKEN ? console.log(`[GITHUB_TOKEN OK]`) : console.warn(`[GITHUB_TOKEN is not defined]`);
|
||||
if (GITHUB_TOKEN) {
|
||||
console.log(`[GITHUB_TOKEN OK]`);
|
||||
} else {
|
||||
console.warn(`[GITHUB_TOKEN is not defined]`);
|
||||
}
|
||||
|
||||
const defaultTransform = axios.defaults.transformRequest;
|
||||
|
||||
@@ -19,6 +23,6 @@ export default axios.create({
|
||||
],
|
||||
baseURL: 'https://api.github.com/',
|
||||
headers: {
|
||||
Authorization: GITHUB_TOKEN ? `token ${GITHUB_TOKEN}` : null,
|
||||
...(GITHUB_TOKEN ? { Authorization: `token ${GITHUB_TOKEN}` } : {}),
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user