From 715aaf0d71e36be765e17ab9435c898171ab9de5 Mon Sep 17 00:00:00 2001 From: alwqx Date: Mon, 29 Apr 2024 17:29:02 +0800 Subject: [PATCH] fix: githubApiToken not equal lead to bad credentials #70 --- README.md | 35 ++++++++++++++++++++---------- src/components/GithubStatistics.js | 2 +- src/reducers/github.js | 3 +-- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index fbafdb0..07d713d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ - --- -

- GitHub Statistics +GitHub Statistics

- --- ![trynow](https://img.shields.io/badge/TRY-NOW-green?url=https://vesoft-inc.github.io/github-statistics/) @@ -23,7 +20,7 @@ ![Image of Yaktocat](/src/image/WX20190912-173245.png) -# Features (WIP) +# Features - [x] Repository overview - [x] Star history @@ -41,18 +38,32 @@ Feature requests are also warmly welcomed. # Development -1. `git clone` and `npm -i` to set up the enviroment. +1. clone repo. + +```shell +git clone https://github.com/vesoft-inc/github-statistics.git +``` + +2. install npm modules. + +```shell +cd github-statistics +npm install +``` -2. set `YOUR_GITHUB_API_TOKEN` in the [.env](./.env) file. +3. **MUST SET** `YOUR_GITHUB_API_TOKEN` in the [.env](./.env) file. Read [Creating a personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) to create token if you don't have one. -3. `npm start` +4. runs the app in the development mode, open [http://localhost:3000](http://localhost:3000) to view it in the browser. -Runs the app in the development mode.
-Open [http://localhost:3000](http://localhost:3000) to view it in the browser. +```shell +npm start +``` -`npm run build` +Build the app for production to the `build` folder.
-Builds the app for production to the `build` folder.
+```shell +npm run build +``` --- diff --git a/src/components/GithubStatistics.js b/src/components/GithubStatistics.js index b9d68ca..1c67ba8 100644 --- a/src/components/GithubStatistics.js +++ b/src/components/GithubStatistics.js @@ -41,7 +41,7 @@ class GithubStatistics extends React.Component { /* eslint-disable-next-line */ var t = btoa(GITHUB_API_TOKEN) /* eslint-disable-next-line */ - this.fetcher = new GithubFetcher(btoa(t)) + this.fetcher = new GithubFetcher(t) this.props.updateState("githubApiToken", t) this.search = _.debounce( diff --git a/src/reducers/github.js b/src/reducers/github.js index 4fdeb95..6a47434 100644 --- a/src/reducers/github.js +++ b/src/reducers/github.js @@ -11,8 +11,7 @@ const INITIAL_STATE = { releaseData: [], releaseStats: {}, - githubApiToken: 'Z2hwX29XQWdNS3gxeXNHRXBlTzV6OEdpdWZvNjc0WkhWZTN0bVlJVQ==', - + githubApiToken: btoa(process.env.REACT_APP_GITHUB_API_TOKEN), } const github = (state = INITIAL_STATE, action) => {