chore: remove redundant codes

`axios` is Promise based, there is no need to wrap it into a Promise constructor again
This commit is contained in:
JounQin 2020-07-15 20:22:06 +08:00 committed by GitHub
parent 2efb399f33
commit 579ed2bab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,17 +34,13 @@ function isValidHexColor(hexColor) {
} }
function request(data) { function request(data) {
return new Promise((resolve, reject) => { return axios({
axios({ url: "https://api.github.com/graphql",
url: "https://api.github.com/graphql", method: "post",
method: "post", headers: {
headers: { Authorization: `bearer ${process.env.GITHUB_TOKEN}`,
Authorization: `bearer ${process.env.GITHUB_TOKEN}`, },
}, data,
data,
})
.then((response) => resolve(response))
.catch((error) => reject(error));
}); });
} }