PDFs in Projekt in public Verzeichnis

This commit is contained in:
ISA
2024-10-18 11:42:52 +02:00
parent 421740cfc3
commit bbe49e549c
21 changed files with 39 additions and 5 deletions

View File

@@ -3,16 +3,35 @@ import { useEffect } from "react";
import { useRouter } from "next/navigation";
import { ClipLoader } from "react-spinners";
// IndexedDB functions only in the browser
let storePage, getPage;
if (typeof window !== "undefined") {
const indexedDBModule = require("../../utils/indexedDB");
storePage = indexedDBModule.storePage;
getPage = indexedDBModule.getPage;
}
export default function WaitPage() {
const router = useRouter();
useEffect(() => {
// Starte den Timer, um nach 20 Sekunden weiterzuleiten
// Store the page as a Blob in IndexedDB in the background
if (typeof window !== "undefined" && storePage) {
const pageContent = `
<div style="text-align: center; margin-top: 100px;">
<h1>Bitte warten...</h1>
<div class="spinner"></div>
<p>Die Seite wird automatisch neu geladen.</p>
</div>`;
storePage("waitPage", new Blob([pageContent], { type: "text/html" }));
}
// Timer to redirect after 20 seconds
const timer = setTimeout(() => {
router.push("/");
}, 20000); // 20 Sekunden warten
}, 20000);
// Timer aufräumen, wenn die Komponente entladen wird
// Cleanup timer when component is unmounted
return () => clearTimeout(timer);
}, [router]);