Files
Triple-C/app/src/hooks/useSettings.ts
Josh Knapp da078af73f
All checks were successful
Build App / build-windows (push) Successful in 2m28s
Build App / build-linux (push) Successful in 3m13s
Remove Anthropic API key authentication support
API key auth only provides short-lived session tokens (8hrs or until
session restart) with no refresh mechanism, unlike OAuth which persists
via .credentials.json. Remove the non-functional API key settings UI
and all supporting code (frontend state, Tauri commands, keyring
storage, container env var injection, and fingerprint-based recreation
checks) to avoid user confusion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 03:59:58 +00:00

41 lines
1021 B
TypeScript

import { useCallback } from "react";
import { useShallow } from "zustand/react/shallow";
import { useAppState } from "../store/appState";
import * as commands from "../lib/tauri-commands";
import type { AppSettings } from "../lib/types";
export function useSettings() {
const { appSettings, setAppSettings } = useAppState(
useShallow(s => ({
appSettings: s.appSettings,
setAppSettings: s.setAppSettings,
}))
);
const loadSettings = useCallback(async () => {
try {
const settings = await commands.getSettings();
setAppSettings(settings);
return settings;
} catch (e) {
console.error("Failed to load settings:", e);
return null;
}
}, [setAppSettings]);
const saveSettings = useCallback(
async (settings: AppSettings) => {
const updated = await commands.updateSettings(settings);
setAppSettings(updated);
return updated;
},
[setAppSettings],
);
return {
appSettings,
loadSettings,
saveSettings,
};
}