Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 04a6422

Browse files
committed
chore: hide token
1 parent de8fdfd commit 04a6422

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/features/dashboard/components/ApiTokenForm/CreateTokenField/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ type TCreateTokenField = {
1818
>;
1919
form_is_cleared: boolean;
2020
setFormIsCleared: Dispatch<SetStateAction<boolean>>;
21+
setHideRestriction: Dispatch<SetStateAction<boolean>>;
2122
};
2223

2324
const CreateTokenField = ({
2425
errors,
2526
register,
2627
form_is_cleared,
2728
setFormIsCleared,
29+
setHideRestriction,
2830
}: TCreateTokenField) => {
2931
const { tokens } = useApiToken();
3032
const [input_value, setInputValue] = useState('');
@@ -49,6 +51,11 @@ const CreateTokenField = ({
4951
const disable_button = token_name_exists || Object.keys(errors).length > 0 || input_value === '';
5052
const error_border_active = token_name_exists || errors.name;
5153

54+
useEffect(() => {
55+
if (error_border_active) {
56+
setHideRestriction(true);
57+
}
58+
}, [error_border_active, setHideRestriction]);
5259
return (
5360
<React.Fragment>
5461
<div className={styles.step_title}>

src/features/dashboard/components/ApiTokenForm/api-token.form.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ const ApiTokenForm = (props: HTMLAttributes<HTMLFormElement>) => {
162162
errors={errors}
163163
form_is_cleared={form_is_cleared}
164164
setFormIsCleared={setFormIsCleared}
165+
setHideRestriction={setHideRestrictions}
165166
/>
166167
{!hiderestrictions && <TokenNameRestrictions />}
167168
<div className={styles.step_title}>

0 commit comments

Comments
 (0)