From ead95a4d038968846a3ff63aa8ed46ee4bcd3193 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 21 Dec 2025 00:17:52 -0600 Subject: [PATCH] Fix origin type errors --- src/components/GitSettingsProvider.test.tsx | 15 ++++++--------- src/components/git/PullRequestDialog.tsx | 2 +- src/hooks/useGitHubOAuth.ts | 3 +-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/components/GitSettingsProvider.test.tsx b/src/components/GitSettingsProvider.test.tsx index e8898854..b0ad091a 100644 --- a/src/components/GitSettingsProvider.test.tsx +++ b/src/components/GitSettingsProvider.test.tsx @@ -20,8 +20,7 @@ function TestComponent() { const credential: GitCredential = { id: crypto.randomUUID(), name: 'GitHub', - protocol: 'https', - host: 'github.com', + origin: 'https://github.com', username: 'git', password: 'test-token', }; @@ -29,7 +28,7 @@ function TestComponent() { }; const handleUpdate = () => { - const githubCred = settings.credentials.find(c => c.host === 'github.com'); + const githubCred = settings.credentials.find(c => c.origin === 'https://github.com'); if (githubCred) { const updatedCredentials = settings.credentials.map((cred) => cred.id === githubCred.id ? { ...cred, password: 'updated-token' } : cred @@ -39,13 +38,13 @@ function TestComponent() { }; const handleRemove = () => { - const githubCred = settings.credentials.find(c => c.host === 'github.com'); + const githubCred = settings.credentials.find(c => c.origin === 'https://github.com'); if (githubCred) { removeCredential(githubCred.id); } }; - const githubCred = settings.credentials.find(c => c.host === 'github.com'); + const githubCred = settings.credentials.find(c => c.origin === 'https://github.com'); return (
@@ -181,8 +180,7 @@ describe('GitSettingsProvider', () => { expect.objectContaining({ credentials: expect.arrayContaining([ expect.objectContaining({ - protocol: 'https', - host: 'github.com', + origin: 'https://github.com', username: 'git', password: 'test-token', }) @@ -199,8 +197,7 @@ describe('GitSettingsProvider', () => { { id: crypto.randomUUID(), name: 'GitLab', - protocol: 'https', - host: 'gitlab.com', + origin: 'https://gitlab.com', username: 'git', password: 'gitlab-token', }, diff --git a/src/components/git/PullRequestDialog.tsx b/src/components/git/PullRequestDialog.tsx index 4337d06c..9fdffb64 100644 --- a/src/components/git/PullRequestDialog.tsx +++ b/src/components/git/PullRequestDialog.tsx @@ -442,7 +442,7 @@ export function PullRequestDialog({ if (remoteInfo.platform !== 'nostr') { credentials = findCredentialsForRepo(remoteUrl || '', settings.credentials); console.log('Found credentials:', credentials ? 'Yes' : 'No'); - console.log('Available credentials:', settings.credentials.map(c => `${c.protocol}://${c.host}`)); + console.log('Available credentials:', settings.credentials.map(c => c.origin)); if (credentials) { console.log('Credential username:', credentials.username); diff --git a/src/hooks/useGitHubOAuth.ts b/src/hooks/useGitHubOAuth.ts index 589ae9c1..53113237 100644 --- a/src/hooks/useGitHubOAuth.ts +++ b/src/hooks/useGitHubOAuth.ts @@ -74,8 +74,7 @@ export function useGitHubOAuth() { addCredential({ id: crypto.randomUUID(), name: 'GitHub', - protocol: 'https', - host: 'github.com', + origin: 'https://github.com', username: result.username || 'git', password: result.accessToken, });