From ef681da60b472a9adcc15e81d5beb3ec0fcff681 Mon Sep 17 00:00:00 2001 From: sorrelbri Date: Tue, 26 May 2020 10:37:29 -0700 Subject: [PATCH] config for 3rd party calendar fetch --- src/utils/index.js | 39 +++++++-------------------------------- webpack.common.js | 4 ---- 2 files changed, 7 insertions(+), 36 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 3a459fa..d19f2b4 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,38 +1,13 @@ -const token = process.env.API_TOKEN; - -const query = (user) => `query { - user (login: "${user}") { - contributionsCollection { - contributionCalendar { - weeks { - contributionDays { - contributionCount - } - } - } - } - } - -}`; - -const options = (user) => ({ - method: "post", - headers: { - "Content-Type": "application/json", - Authorization: `bearer ${token}`, - }, - body: JSON.stringify({ - query: query(user), - }), -}); +const options = { + method: "get", +}; const getCalendar = (user) => { - return fetch(`https://api.github.com/graphql`, options(user)) + return fetch( + `https://appkeychain.herokuapp.com/git/calendar/${user}`, + options + ) .then((res) => res.json()) - .then( - (result) => - result.data.user.contributionsCollection.contributionCalendar.weeks - ) .catch((e) => e); }; diff --git a/webpack.common.js b/webpack.common.js index 31e1870..5f39f71 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -1,7 +1,6 @@ const path = require("path"); const { CleanWebpackPlugin } = require("clean-webpack-plugin"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -const { DefinePlugin } = require("webpack"); module.exports = { entry: { @@ -13,9 +12,6 @@ module.exports = { new HtmlWebpackPlugin({ template: "index.html", }), - new DefinePlugin({ - "process.env.API_TOKEN": JSON.stringify(process.env.API_TOKEN), - }), ], output: { filename: "[name].bundle.js",