make sure that secret is defined before trying to decode (#479)

Signed-off-by: Sebastian Malton <smalton@mirantis.com>

Co-authored-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
Sebastian MaltonandSebastian Malton authored and Lauri Nevala committed 2020-06-24 09:18:28 +03:00
1 parent 29d6b0b989
commit bd58456a10
1 file changed
+7 -6
@@ -120,8 +120,11 @@ const SecretKey = (props: SecretKeyProps) => {
setSecret(secret)
}
if (!secret) {
return (
if (secret?.data?.[key]) {
return <>{base64.decode(secret.data[key])}</>
}
return (
<>
secretKeyRef({name}.{key})&nbsp;
<Icon
@@ -131,7 +134,5 @@ const SecretKey = (props: SecretKeyProps) => {
onClick={showKey}
/>
</>
)
}
return <>{base64.decode(secret.data[key])}</>
}
)
}