diff --git a/DirectReport/browserview/dashboard/routes.py b/DirectReport/browserview/dashboard/routes.py index 678923b8..bfc84a88 100644 --- a/DirectReport/browserview/dashboard/routes.py +++ b/DirectReport/browserview/dashboard/routes.py @@ -54,7 +54,9 @@ def dashboard_reports_update(): prompt = "" prompt = request.get_json()["prompt"] client = GithubClient() - user_repos = client.get_user_repos(current_user.github_username) + h_token = session['header_token'] + print(current_user.github_username) + user_repos = client.get_user_repos(current_user.github_username, h_token) repodata = [] for repo in user_repos: repodata.append(repo["name"]) diff --git a/DirectReport/browserview/services/github.py b/DirectReport/browserview/services/github.py index 50b74e97..648bc579 100644 --- a/DirectReport/browserview/services/github.py +++ b/DirectReport/browserview/services/github.py @@ -67,9 +67,9 @@ def get_pull_requests_count(self, repo_owner, repo_name): response.raise_for_status() return len(response.json()) - def get_user_repos(self, repo_owner): + def get_user_repos(self, repo_owner, token): url = f"https://api.github.com/users/{repo_owner}/repos?sort=updated&order=desc" - headers = {"Authorization": f"token {appsecrets.GITHUB_TOKEN}"} + headers = {"Authorization": f"token {token}"} response = requests.get(url, headers=headers) response.raise_for_status() return response.json() @@ -102,6 +102,7 @@ def query(self, prompt): def get_data_from(self, prompt): response = self.query(prompt) + print(response) response_data = response["candidates"][0]["output"] json_loaded = json.loads(response_data) return json_loaded diff --git a/DirectReport/browserview/static/js/account/account_components.js b/DirectReport/browserview/static/js/account/account_components.js index 54f6052b..e1fe8c5d 100644 --- a/DirectReport/browserview/static/js/account/account_components.js +++ b/DirectReport/browserview/static/js/account/account_components.js @@ -24,21 +24,22 @@ const AccountUserInfo = (userData, reportData) => { -
- NUMBER OF REPORTS SAVED: {reportData.length} + NUMBER OF REPORTS SAVED: + {reportData.length}
- LAST REPORT: DEC - 12, 2021 + LAST REPORT: + DEC 12, 2021
- GITHUB ACOUNT USERNAME: {userData.github_username} + GITHUB ACOUNT USERNAME: + {userData.github_username}
- SELECTED REPO: DirectReport + SELECTED REPO: + DirectReport
diff --git a/DirectReport/browserview/templates/account.html b/DirectReport/browserview/templates/account.html
index 4b83f824..cf60cebf 100644
--- a/DirectReport/browserview/templates/account.html
+++ b/DirectReport/browserview/templates/account.html
@@ -14,7 +14,7 @@
{% block content %}