forked from baron/baron-sso
fix: follow rules of hooks in TenantSchemaPage
This commit is contained in:
@@ -58,7 +58,10 @@ export function TenantSchemaPage() {
|
||||
|
||||
const tenantQuery = useQuery({
|
||||
queryKey: ["tenant", tenantId],
|
||||
queryFn: () => fetchTenant(tenantId!),
|
||||
queryFn: () => {
|
||||
if (!tenantId) throw new Error("Tenant ID is required");
|
||||
return fetchTenant(tenantId);
|
||||
},
|
||||
enabled: !!tenantId && canAccess,
|
||||
});
|
||||
|
||||
@@ -94,6 +97,8 @@ export function TenantSchemaPage() {
|
||||
|
||||
const updateMutation = useMutation({
|
||||
mutationFn: (newFields: SchemaField[]) => {
|
||||
if (!tenantId) throw new Error("Tenant ID is required");
|
||||
|
||||
// Remove legacy loginIdField, keep isLoginId natively in userSchema
|
||||
const newConfig = { ...tenantQuery.data?.config };
|
||||
newConfig.loginIdField = undefined;
|
||||
|
||||
Reference in New Issue
Block a user