fix: normalize null fields from unconfigured OIDC response
When no OIDC config exists, the backend returns an object with all null fields (via OidcAdminConfigResponse.unconfigured()). Normalize all null values to sensible defaults when loading the form instead of passing nulls through to Input components and .map() calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -38,8 +38,17 @@ export default function OidcConfigPage() {
|
||||
const { toast } = useToast();
|
||||
|
||||
useEffect(() => {
|
||||
adminFetch<OidcFormData>('/oidc')
|
||||
.then(setForm)
|
||||
adminFetch<Partial<OidcFormData> & { configured?: boolean }>('/oidc')
|
||||
.then((data) => setForm({
|
||||
enabled: data.enabled ?? false,
|
||||
autoSignup: data.autoSignup ?? true,
|
||||
issuerUri: data.issuerUri ?? '',
|
||||
clientId: data.clientId ?? '',
|
||||
clientSecret: data.clientSecret ?? '',
|
||||
rolesClaim: data.rolesClaim ?? 'roles',
|
||||
displayNameClaim: data.displayNameClaim ?? 'name',
|
||||
defaultRoles: data.defaultRoles ?? ['VIEWER'],
|
||||
}))
|
||||
.catch(() => setForm(EMPTY_CONFIG));
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user