mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-03-10 06:00:19 +00:00
fix: git connection fix for starter template (#1411)
This commit is contained in:
parent
3368b7903e
commit
4404f4a5c0
@ -3,6 +3,7 @@ import { motion } from 'framer-motion';
|
|||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import { logStore } from '~/lib/stores/logs';
|
import { logStore } from '~/lib/stores/logs';
|
||||||
import { classNames } from '~/utils/classNames';
|
import { classNames } from '~/utils/classNames';
|
||||||
|
import Cookies from 'js-cookie';
|
||||||
|
|
||||||
interface GitHubUserResponse {
|
interface GitHubUserResponse {
|
||||||
login: string;
|
login: string;
|
||||||
@ -175,6 +176,8 @@ export function GithubConnection() {
|
|||||||
if (parsed.user && parsed.token) {
|
if (parsed.user && parsed.token) {
|
||||||
fetchGitHubStats(parsed.token);
|
fetchGitHubStats(parsed.token);
|
||||||
}
|
}
|
||||||
|
} else if (import.meta.env.VITE_GITHUB_ACCESS_TOKEN) {
|
||||||
|
fetchGithubUser(import.meta.env.VITE_GITHUB_ACCESS_TOKEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@ -206,6 +209,10 @@ export function GithubConnection() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
localStorage.setItem('github_connection', JSON.stringify(newConnection));
|
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);
|
setConnection(newConnection);
|
||||||
|
|
||||||
await fetchGitHubStats(token);
|
await fetchGitHubStats(token);
|
||||||
|
Loading…
Reference in New Issue
Block a user