auto-claude: subtask-1-2 - Create client-side CSRF token retrieval utility
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user