Change onOAuthChange to pass all OAuth fields together

Replace onOAuthChange(field, value) with onOAuthChange(oauth) where
oauth is { clientId, clientSecret, scopes }. Each keystroke now
reports the full OAuth state, not just the single field that changed.
This lets the consumer see the complete picture on every change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
cliffhall 2026-04-21 20:15:12 -04:00
commit d27018b4f2

View file

@ -5,6 +5,7 @@ import { ListToggle } from "../../elements/ListToggle/ListToggle";
import {
ServerSettingsForm,
type ServerSettingsSection,
type OAuthSettings,
} from "../ServerSettingsForm/ServerSettingsForm";
const ALL_SECTIONS: ServerSettingsSection[] = [
@ -88,14 +89,13 @@ export function ServerSettingsModal({
onSettingsChange({ ...settings, [field]: value });
}
function handleOAuthChange(field: string, value: string) {
const oauthFieldMap: Record<string, string> = {
clientId: "oauthClientId",
clientSecret: "oauthClientSecret",
scopes: "oauthScopes",
};
const settingsKey = oauthFieldMap[field] ?? field;
onSettingsChange({ ...settings, [settingsKey]: value });
function handleOAuthChange(oauth: OAuthSettings) {
onSettingsChange({
...settings,
oauthClientId: oauth.clientId,
oauthClientSecret: oauth.clientSecret,
oauthScopes: oauth.scopes,
});
}
return (