From 579ed2bab87fa4e5b18b93a0360f176499229f1e Mon Sep 17 00:00:00 2001 From: JounQin Date: Wed, 15 Jul 2020 20:22:06 +0800 Subject: [PATCH] chore: remove redundant codes `axios` is Promise based, there is no need to wrap it into a Promise constructor again --- src/utils.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/utils.js b/src/utils.js index 470a9e8..6db120f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -34,17 +34,13 @@ function isValidHexColor(hexColor) { } function request(data) { - return new Promise((resolve, reject) => { - axios({ - url: "https://api.github.com/graphql", - method: "post", - headers: { - Authorization: `bearer ${process.env.GITHUB_TOKEN}`, - }, - data, - }) - .then((response) => resolve(response)) - .catch((error) => reject(error)); + return axios({ + url: "https://api.github.com/graphql", + method: "post", + headers: { + Authorization: `bearer ${process.env.GITHUB_TOKEN}`, + }, + data, }); }