Files
medreport_mrb2b/packages/ui/src/makerkit/authenticity-token.tsx
2025-06-08 16:18:30 +03:00

18 lines
347 B
TypeScript

'use client';
export function AuthenticityToken() {
const token = useCsrfToken();
return <input type="hidden" name="csrf_token" value={token} />;
}
function useCsrfToken() {
if (typeof window === 'undefined') return '';
return (
document
.querySelector('meta[name="csrf-token"]')
?.getAttribute('content') ?? ''
);
}