mirror of
https://github.com/logto-io/logto.git
synced 2025-03-24 22:41:28 -05:00
fix(console): add default value for custom auth rules in protected app details (#5360)
This commit is contained in:
parent
f53a14d7a8
commit
bc127751b3
1 changed files with 8 additions and 1 deletions
|
@ -6,7 +6,7 @@ import {
|
|||
} from '@logto/schemas';
|
||||
import { cond } from '@silverhand/essentials';
|
||||
import classNames from 'classnames';
|
||||
import { type ChangeEvent, useState } from 'react';
|
||||
import { type ChangeEvent, useState, useEffect } from 'react';
|
||||
import { Controller, useFieldArray, useFormContext } from 'react-hook-form';
|
||||
import { Trans, useTranslation } from 'react-i18next';
|
||||
import useSWR from 'swr';
|
||||
|
@ -56,6 +56,7 @@ function ProtectedAppSettings({ data }: Props) {
|
|||
control,
|
||||
register,
|
||||
getFieldState,
|
||||
setValue,
|
||||
formState: { errors },
|
||||
} = useFormContext<ApplicationForm>();
|
||||
|
||||
|
@ -64,6 +65,12 @@ function ProtectedAppSettings({ data }: Props) {
|
|||
name: 'protectedAppMetadata.pageRules',
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (fields.length === 0) {
|
||||
setValue('protectedAppMetadata.pageRules', [{ path: '' }]);
|
||||
}
|
||||
}, [fields.length, setValue]);
|
||||
|
||||
if (!data.protectedAppMetadata) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue