diff --git a/components/h5web/h5web.jsx b/components/h5web/h5web.jsx index 2469ec2..3a2e62e 100755 --- a/components/h5web/h5web.jsx +++ b/components/h5web/h5web.jsx @@ -6,7 +6,6 @@ import { useLocation, useSearchParams } from "react-router-dom"; // eslint-disable-next-line react/prop-types export default function H5web({ domain }) { - let [searchParams, setSearchParams] = useSearchParams(); const location = useLocation(); @@ -15,16 +14,20 @@ export default function H5web({ domain }) { const initialPathParams = searchParams.get("initialPath"); - const [hash, useHash] = useState(decodeURIComponent(window.location.hash.substring(1))) - + const [hash, useHash] = useState( + decodeURIComponent(window.location.hash.substring(1)) + ); - const initialPath = initialPathParams ? initialPathParams : - hash ? hash : '/' + const initialPath = initialPathParams ? initialPathParams : hash ? hash : "/"; const downloadFile = () => { - fetch(`${import.meta.env.VITE_BaseURL}db/download?what=h5&domain=${domain ? domain : h5webParams}`) - .then(resp => resp.blob()) - .then(blob => { + fetch( + `${import.meta.env.VITE_BaseURL}db/download?what=h5&domain=${ + domain ? domain : h5webParams + }` + ) + .then((resp) => resp.blob()) + .then((blob) => { const url = window.URL.createObjectURL(blob); const a = document.createElement("a"); a.style.display = "none"; @@ -33,22 +36,18 @@ export default function H5web({ domain }) { document.body.appendChild(a); a.click(); window.URL.revokeObjectURL(url); - }) .catch(() => alert("Failed to download the file!")); -} + }; return (
-
-
+