mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
15 lines
354 B
JavaScript
15 lines
354 B
JavaScript
import { getCookie } from './cookie.js';
|
|
|
|
import { CSRF_COOKIE_NAME, CSRF_CUSTOM_HEADER_NAME } from '../constants/csrf_constants';
|
|
|
|
|
|
export function getCsrfToken() {
|
|
return getCookie(CSRF_COOKIE_NAME);
|
|
}
|
|
|
|
export function makeCsrfHeader(csrfToken = getCsrfToken()) {
|
|
return csrfToken ? {
|
|
[CSRF_CUSTOM_HEADER_NAME]: csrfToken
|
|
} : {};
|
|
}
|