Skip to content

Commit

Permalink
Again some lint cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Arne Durr committed Dec 17, 2024
1 parent 1c66d4e commit 761f142
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions app/lib/hooks/useGitProviders.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { useState, useEffect } from 'react';
import { toast } from 'react-toastify';
import { lookupSavedPassword, saveGitAuth, ensureEncryption, removeGitAuth } from './useCredentials';
import { gitProviders, type ProviderState, type ProviderCredentials, type GitHubUser, type GitLabUser } from '~/utils/gitProviders';
import {
gitProviders,
type ProviderState,
type ProviderCredentials,
type GitHubUser,
type GitLabUser,
} from '~/utils/gitProviders';

const initialCredentials: ProviderState = {
github: { username: '', token: '', isConnected: false, isVerifying: false },
Expand Down Expand Up @@ -54,6 +60,7 @@ export function useGitProviders() {

// Different authorization header format for GitHub and GitLab
let headers;

if (providerKey === 'github') {
headers = {
Authorization: `Bearer ${token}`,
Expand All @@ -68,14 +75,14 @@ export function useGitProviders() {
};
}

const response = await fetch(apiUrl, { headers: headers });
const response = await fetch(apiUrl, { headers });
const data = await response.json();

// Verify the response data
const isValid =
response.ok &&
((providerKey === 'github' && (data as GitHubUser).login === username) ||
(providerKey === 'gitlab' && (data as GitLabUser).username === username));
response.ok &&
((providerKey === 'github' && (data as GitHubUser).login === username) ||
(providerKey === 'gitlab' && (data as GitLabUser).username === username));

setCredentials((prev) => ({
...prev,
Expand Down

0 comments on commit 761f142

Please sign in to comment.