fix(auth): make login footer legal links open real pages, not the login tab

The login-page footer linked to /offer, /privacy and /recurrent-payments with
target=_blank, but none of those routes existed, so opening them hit the SPA
catch-all, which redirects unauthenticated users to /login — every footer link
just opened another login tab.

- Add a public PublicLegal page that fetches the offer / privacy document from the
  existing public /cabinet/info endpoints and renders sanitized HTML (DOMPurify via
  the shared formatContent helper).
- Register public /offer and /privacy routes.
- Extract sanitizeHtml/formatContent into src/utils/legalContent.ts and reuse from
  Info.tsx (was duplicated).
- Drop the /recurrent-payments footer link: there is no recurring-payments legal
  document or endpoint in the backend, so it had no real destination. Re-add once
  such a document exists.

type-check, eslint, prettier and build all pass.
This commit is contained in:
Fringg
2026-07-09 18:14:49 +03:00
parent 8f31311112
commit 37a53e40ea
7 changed files with 185 additions and 86 deletions

View File

@@ -7,10 +7,12 @@ interface LegalLink {
fallback: string;
}
// Recurring-payments has no dedicated legal document in the backend yet, so it is
// intentionally omitted rather than pointed at unrelated content. Re-add once a
// `recurrent-payments` document + public endpoint exist.
const LINKS: LegalLink[] = [
{ href: '/offer', labelKey: 'footer.offer', fallback: 'Публичная оферта' },
{ href: '/privacy', labelKey: 'footer.privacy', fallback: 'Политика конфиденциальности' },
{ href: '/recurrent-payments', labelKey: 'footer.recurrent', fallback: 'Рекуррентные платежи' },
];
interface LegalFooterProps {