mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01: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();
|
||||
|
||||
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})
|
||||
}
|
||||
}, [data, environments]);
|
||||
|
||||
const clear = () => {
|
||||
setData({...INITIAL_DATA});
|
||||
const environment = environments && environments.length > 0 ? environments[0].name : undefined;
|
||||
setData({...INITIAL_DATA, environment });
|
||||
setError({});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user