gendesign/.design-sync/previews/RouteGuard.tsx

15 lines
758 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { RouteGuard } from 'tradein-mvp-frontend';
/** RBAC-обёртка. useMe() читает /api/v1/me — в превью-окружении сети нет,
* поэтому guard рендерит свой gated-state (NoAccessScreen "Доступа нет" при
* ошибке /me, либо ничего во время загрузки). Fetch-coupled на useMe. */
export const Default = () => (
<RouteGuard>
<div className="card" style={{ padding: 24 }}>
<h2 style={{ margin: 0 }}>Защищённый раздел</h2>
<p style={{ margin: '8px 0 0', color: 'var(--fg-secondary)' }}>
Этот контент виден только при разрешённой роли.
</p>
</div>
</RouteGuard>
);