From 761f142b18fdf80620d2cbc94a8e7e26ae133a4d Mon Sep 17 00:00:00 2001 From: Arne Durr Date: Tue, 17 Dec 2024 15:57:50 +0100 Subject: [PATCH] Again some lint cleanup --- app/lib/hooks/useGitProviders.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/lib/hooks/useGitProviders.ts b/app/lib/hooks/useGitProviders.ts index a94f39e0a..782bdaa68 100644 --- a/app/lib/hooks/useGitProviders.ts +++ b/app/lib/hooks/useGitProviders.ts @@ -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 }, @@ -54,6 +60,7 @@ export function useGitProviders() { // Different authorization header format for GitHub and GitLab let headers; + if (providerKey === 'github') { headers = { Authorization: `Bearer ${token}`, @@ -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,