fix(settings): fix Zai API key clear/save and update GitManagerModal tests

- hasApiKey now only returns true for stored api_key credentials; previously
  it fell back to hasAuth() which includes env vars, causing Clear to appear
  to do nothing and Save to never appear
- Save button now shows when user types into the key input even if already
  authenticated, allowing key updates without clearing first
- Remove unused importFile state variable (TS 6133 lint error)
- Update GitManagerModal tests to pass undefined as projectId argument to
  all API mocks, matching the component's project-aware API signatures

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-13 09:48:59 -07:00
parent 8874c0d73a
commit 36d5373a6e
3 changed files with 19 additions and 19 deletions

View File

@@ -87,7 +87,7 @@ export function wrapAuthStorageWithApiKeyProviders(
},
hasApiKey: (providerId) => {
const credential = authStorage.get(providerId);
return credential?.type === "api_key" || authStorage.hasAuth(providerId);
return credential?.type === "api_key" && !!credential.key;
},
getApiKey: (providerId) => authStorage.getApiKey(providerId),
get: (providerId) => authStorage.get(providerId),