"use client"; import { useEffect } from "react"; import { useAuthStore } from "@/stores/auth-store"; export default function NotFound() { const isAuthenticated = useAuthStore((s) => s.isAuthenticated); useEffect(() => { if (!isAuthenticated) { // Don't redirect admin routes to the webmail login page const isAdminRoute = window.location.pathname === '/admin' || window.location.pathname.startsWith('/admin/'); if (!isAdminRoute) { window.location.href = "/login"; } } }, [isAuthenticated]); if (!isAuthenticated) { // Allow admin routes to render the 404 without redirecting const isAdmin = typeof window !== 'undefined' && (window.location.pathname === '/admin' || window.location.pathname.startsWith('/admin/')); if (!isAdmin) return null; } return (

404

This page could not be found.

Go home
); }