Fix issue with undefined variable

Fix issue with undefined variable when data related to `me` is not
available.
This commit is contained in:
nixocio 2020-09-18 12:24:10 -04:00
parent 56c5a39087
commit 9d0b37e96c

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`)}
/>