Merge pull request #8179 from nixocio/ui_fix_undefined_variable

Fix issue with undefined variable

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-09-21 18:28:15 +00:00 committed by GitHub
commit dc492d0cfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,7 +15,7 @@ function InstanceToggle({
onToggle,
i18n,
}) {
const { me } = useConfig();
const { me = {} } = useConfig();
const [isEnabled, setIsEnabled] = useState(instance.enabled);
const [showError, setShowError] = useState(false);
@ -58,7 +58,7 @@ function InstanceToggle({
label={i18n._(t`On`)}
labelOff={i18n._(t`Off`)}
isChecked={isEnabled}
isDisabled={isLoading || !me.is_superuser}
isDisabled={isLoading || !me?.is_superuser}
onChange={toggleInstance}
aria-label={i18n._(t`Toggle instance`)}
/>