auto-claude: subtask-1-2 - Create client-side CSRF token retrieval utility

This commit is contained in:
2026-01-25 06:33:36 +01:00
parent b1e89b64c5
commit 87261c6b92
+17
View File
@@ -0,0 +1,17 @@
const CSRF_META_TAG_NAME = 'csrf-token';
/**
* Get the CSRF token from the meta tag in the document head
* The server should render: <meta name="csrf-token" content="..." />
*/
export function getCsrfToken(): string | null {
if (typeof document === 'undefined') {
return null;
}
const metaTag = document.querySelector<HTMLMetaElement>(
`meta[name="${CSRF_META_TAG_NAME}"]`
);
return metaTag?.content || null;
}