From a087494f6809a7a8ea8e6c27a105d8c8f0f3839e Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Wed, 4 Sep 2024 10:27:24 +0200 Subject: Updated the libraries --- src/components/Content/Content.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/components/Content/Content.tsx') diff --git a/src/components/Content/Content.tsx b/src/components/Content/Content.tsx index e670376..94fca32 100644 --- a/src/components/Content/Content.tsx +++ b/src/components/Content/Content.tsx @@ -4,7 +4,7 @@ import { Headers, RequestPayload, ResponsePayload } from "~hooks/useRequests"; import ReactJson from "react-json-view"; import styles from "~/components/Content/Content.module.scss"; import { Button, Col, Container, Row } from "react-bootstrap"; -import { DarkModeContext } from "~/contexts/DarkMode"; +import { SettingsContext } from "~/contexts/Settings"; function getHeader( headers: Headers, @@ -80,14 +80,14 @@ export default function Content({ } function ContentBody({ data, raw = false }: Omit) { - const { darkMode } = useContext(DarkModeContext); + const { darkMode } = useContext(SettingsContext); const contentType = useMemo(() => { if (raw) { return ""; } const type = getHeader(data.headers, "content-type"); - return type.toLowerCase().split(";")[0]; + return type?.toLowerCase().split(";")[0]; }, [data, raw]); if (raw) { @@ -98,7 +98,10 @@ function ContentBody({ data, raw = false }: Omit) { ); } - if (["application/pdf", "text/html"].includes(contentType)) { + if ( + contentType !== undefined && + ["application/pdf", "text/html"].includes(contentType) + ) { return (