From 4404f4a5c0a4bb5848d0f7121564b9e55007408a Mon Sep 17 00:00:00 2001 From: Anirban Kar Date: Sun, 2 Mar 2025 12:58:13 +0530 Subject: [PATCH] fix: git connection fix for starter template (#1411) --- .../@settings/tabs/connections/GithubConnection.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/components/@settings/tabs/connections/GithubConnection.tsx b/app/components/@settings/tabs/connections/GithubConnection.tsx index e2d8924f..9f433724 100644 --- a/app/components/@settings/tabs/connections/GithubConnection.tsx +++ b/app/components/@settings/tabs/connections/GithubConnection.tsx @@ -3,6 +3,7 @@ import { motion } from 'framer-motion'; import { toast } from 'react-toastify'; import { logStore } from '~/lib/stores/logs'; import { classNames } from '~/utils/classNames'; +import Cookies from 'js-cookie'; interface GitHubUserResponse { login: string; @@ -175,6 +176,8 @@ export function GithubConnection() { if (parsed.user && parsed.token) { fetchGitHubStats(parsed.token); } + } else if (import.meta.env.VITE_GITHUB_ACCESS_TOKEN) { + fetchGithubUser(import.meta.env.VITE_GITHUB_ACCESS_TOKEN); } setIsLoading(false); @@ -206,6 +209,10 @@ export function GithubConnection() { }; localStorage.setItem('github_connection', JSON.stringify(newConnection)); + Cookies.set('githubToken', token); + Cookies.set('githubUsername', data.login); + Cookies.set('git:github.com', JSON.stringify({ username: token, password: 'x-oauth-basic' })); + setConnection(newConnection); await fetchGitHubStats(token);