2
0
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:
Azanda
2026-06-01 17:47:02 +02:00
committed by GitHub
parent 030e722383
commit 32e2515f1e
+6 -2
View File
@@ -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}` } : {}),
},
});