"use client"; import Image from "next/image"; import React, { useEffect, useState } from "react"; import { Button } from "@mui/material"; import { DEFAULT_MAINTENANCE_MESSAGE } from "@/lib/maintenance"; const RECHECK_INTERVAL_MS = 60_000; function MaintenancePage() { const [message, setMessage] = useState(DEFAULT_MAINTENANCE_MESSAGE); // پیام واقعی را interceptor هنگام دریافت ۵۰۳ ذخیره کرده است. useEffect(() => { try { const stored = sessionStorage.getItem("maintenance_message"); if (stored) setMessage(stored); } catch { } }, []); // اگر تعمیرات تمام شد کاربر نباید تا رفرش دستی پشت این صفحه بماند. useEffect(() => { const timer = setInterval(async () => { try { const response = await fetch("/", { method: "HEAD", cache: "no-store" }); if (response.status !== 503) window.location.href = "/"; } catch { } }, RECHECK_INTERVAL_MS); return () => clearInterval(timer); }, []); return (
maintenance-cover

در حال به‌روزرسانی سیستم

{message}

maintenance-cover
); } export default MaintenancePage;