From 9d0b37e96cf2e07bc739b78f1996f37c0ad635ef Mon Sep 17 00:00:00 2001 From: nixocio Date: Fri, 18 Sep 2020 12:24:10 -0400 Subject: [PATCH] Fix issue with undefined variable Fix issue with undefined variable when data related to `me` is not available. --- awx/ui_next/src/components/InstanceToggle/InstanceToggle.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/ui_next/src/components/InstanceToggle/InstanceToggle.jsx b/awx/ui_next/src/components/InstanceToggle/InstanceToggle.jsx index 609938b57d..f3c08f64a6 100644 --- a/awx/ui_next/src/components/InstanceToggle/InstanceToggle.jsx +++ b/awx/ui_next/src/components/InstanceToggle/InstanceToggle.jsx @@ -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`)} />