Admin: Berichten-scherm met formulierschakelaar, lijst, detail en opnieuw mailen (CMS-U6)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { NotFoundPage } from '@/pages/NotFoundPage';
|
||||
import { useContactSettings } from '../services/useContactSettings';
|
||||
|
||||
/**
|
||||
* The module can be loaded while the management routes are closed (host switch off: every route answers 404 with an
|
||||
* empty body). In that case the screen does not exist: the usual "not found" page is shown.
|
||||
*/
|
||||
export function ContactAvailabilityGuard({ children }: { children: ReactNode }) {
|
||||
const { data, isPending, isError } = useContactSettings();
|
||||
|
||||
if (isPending) {
|
||||
return (
|
||||
<div className="flex min-h-40 items-center justify-center text-muted-foreground">
|
||||
<span className="h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (isError || data === null) return <NotFoundPage />;
|
||||
return <>{children}</>;
|
||||
}
|
||||
Reference in New Issue
Block a user