fix: git connection fix for starter template (#1411)
Some checks are pending
Docker Publish / docker-build-publish (push) Waiting to run
Update Stable Branch / prepare-release (push) Waiting to run

This commit is contained in:
Anirban Kar 2025-03-02 12:58:13 +05:30 committed by GitHub
parent 3368b7903e
commit 4404f4a5c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);