mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-19 01:17:18 +02:00
fix: not set env if undefined
This commit is contained in:
parent
236c798380
commit
139098fda9
@ -42,13 +42,14 @@ const ApiTokenCreate = ({
|
|||||||
const { environments } = useEnvironments();
|
const { environments } = useEnvironments();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(environments && data.type === TYPE_CLIENT && !data.environment) {
|
if(environments && environments.length > 0 && data.type === TYPE_CLIENT && !data.environment) {
|
||||||
setData({...data, environment: environments[0].name})
|
setData({...data, environment: environments[0].name})
|
||||||
}
|
}
|
||||||
}, [data, environments]);
|
}, [data, environments]);
|
||||||
|
|
||||||
const clear = () => {
|
const clear = () => {
|
||||||
setData({...INITIAL_DATA});
|
const environment = environments && environments.length > 0 ? environments[0].name : undefined;
|
||||||
|
setData({...INITIAL_DATA, environment });
|
||||||
setError({});
|
setError({});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user