mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-06 21:57:48 +01:00
Add setting to hide widgets on failure
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
import { useContext } from "react";
|
||||
|
||||
import Error from "./error";
|
||||
|
||||
import { SettingsContext } from "utils/contexts/settings";
|
||||
|
||||
export default function Container({ error = false, children, service }) {
|
||||
const { settings } = useContext(SettingsContext);
|
||||
|
||||
if (error) {
|
||||
return <Error error={error} />
|
||||
if (settings.hideErrors || service.widget.hide_errors) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <Error service={service} error={error} />
|
||||
}
|
||||
|
||||
let visibleChildren = children;
|
||||
|
||||
@@ -9,12 +9,10 @@ function displayData(data) {
|
||||
return (data.type === 'Buffer') ? Buffer.from(data).toString() : JSON.stringify(data, 4);
|
||||
}
|
||||
|
||||
export default function Error({ error }) {
|
||||
export default function Error({ error: err }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (error?.data?.error) {
|
||||
error = error.data.error; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
const { error } = err?.data ?? { error: err };
|
||||
|
||||
return (
|
||||
<details className="px-1 pb-1">
|
||||
|
||||
Reference in New Issue
Block a user