mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-14 04:06:45 +00:00
14 lines
423 B
TypeScript
14 lines
423 B
TypeScript
![]() |
import { csrfCookieName } from '@datahub/utils/helpers/csrf-token';
|
||
|
import { v4 as getUuid } from 'ember-uuid';
|
||
|
|
||
|
/**
|
||
|
* Augments the document cookie object with the CSRF protection cookie
|
||
|
*/
|
||
|
export const setCSRFCookieToken = (): string => {
|
||
|
const currentCookieState = document.cookie;
|
||
|
const csrfCookie = `${csrfCookieName}=${getUuid()}; `;
|
||
|
document.cookie = currentCookieState + csrfCookie;
|
||
|
|
||
|
return csrfCookie;
|
||
|
};
|