fix up git

This commit is contained in:
2026-06-30 15:06:12 +07:00
parent 11e5a76977
commit 38e22b3390
13 changed files with 883 additions and 18 deletions

View File

@@ -4,6 +4,7 @@ import { apiGitHub } from '../api';
export function useGitHubConnection() {
const [connected, setConnected] = useState(false);
const [githubLogin, setGithubLogin] = useState('');
const [canDeleteRepos, setCanDeleteRepos] = useState(false);
const [connecting, setConnecting] = useState(false);
const [error, setError] = useState('');
const [message, setMessage] = useState('');
@@ -13,10 +14,12 @@ export function useGitHubConnection() {
const st = await apiGitHub.status();
setConnected(!!st.connected);
setGithubLogin(st.githubLogin || '');
setCanDeleteRepos(!!st.canDeleteRepos);
} catch (e) {
console.error(e);
setConnected(false);
setGithubLogin('');
setCanDeleteRepos(false);
}
}, []);
@@ -65,6 +68,7 @@ export function useGitHubConnection() {
await apiGitHub.disconnect();
setConnected(false);
setGithubLogin('');
setCanDeleteRepos(false);
setMessage('Đã ngắt kết nối GitHub');
} catch (e: any) {
setError(e?.message || 'Ngắt kết nối thất bại');
@@ -74,6 +78,7 @@ export function useGitHubConnection() {
return {
connected,
githubLogin,
canDeleteRepos,
connecting,
error,
message,