mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 18:51:06 -03:30
Fix issue with undefined variable
Fix issue with undefined variable when data related to `me` is not available.
This commit is contained in:
@@ -15,7 +15,7 @@ function InstanceToggle({
|
|||||||
onToggle,
|
onToggle,
|
||||||
i18n,
|
i18n,
|
||||||
}) {
|
}) {
|
||||||
const { me } = useConfig();
|
const { me = {} } = useConfig();
|
||||||
const [isEnabled, setIsEnabled] = useState(instance.enabled);
|
const [isEnabled, setIsEnabled] = useState(instance.enabled);
|
||||||
const [showError, setShowError] = useState(false);
|
const [showError, setShowError] = useState(false);
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ function InstanceToggle({
|
|||||||
label={i18n._(t`On`)}
|
label={i18n._(t`On`)}
|
||||||
labelOff={i18n._(t`Off`)}
|
labelOff={i18n._(t`Off`)}
|
||||||
isChecked={isEnabled}
|
isChecked={isEnabled}
|
||||||
isDisabled={isLoading || !me.is_superuser}
|
isDisabled={isLoading || !me?.is_superuser}
|
||||||
onChange={toggleInstance}
|
onChange={toggleInstance}
|
||||||
aria-label={i18n._(t`Toggle instance`)}
|
aria-label={i18n._(t`Toggle instance`)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user