mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
13 lines
415 B
TypeScript
13 lines
415 B
TypeScript
import { getCookie } from "tiny-cookie";
|
|
import { CSRF } from "@shared/constants";
|
|
|
|
/**
|
|
* Reads the CSRF token that the server attached to the current document,
|
|
* preferring the host-bound cookie when present.
|
|
*
|
|
* @returns The token, or an empty string when no CSRF cookie is present.
|
|
*/
|
|
export function getCSRFToken(): string {
|
|
return getCookie(CSRF.secureCookieName) ?? getCookie(CSRF.cookieName) ?? "";
|
|
}
|