2022-02-21 03:50:03 +01:00
|
|
|
export const getCsrfToken = (): string | null => {
|
2022-07-13 03:45:36 +02:00
|
|
|
const meta = document.head.querySelector('meta[name="_csrf"]');
|
|
|
|
if (!meta) {
|
2022-10-31 06:17:01 +01:00
|
|
|
return '';
|
2022-07-13 03:45:36 +02:00
|
|
|
}
|
|
|
|
return meta.getAttribute('content');
|
2022-02-21 03:50:03 +01:00
|
|
|
};
|
|
|
|
|
2023-01-14 07:33:17 +01:00
|
|
|
export const getCsrfTokenParameter = (): string | null => {
|
2022-07-13 03:45:36 +02:00
|
|
|
const meta = document.head.querySelector('meta[name="_csrf_parameter"]');
|
|
|
|
if (!meta) {
|
2022-10-31 06:17:01 +01:00
|
|
|
return '';
|
2022-07-13 03:45:36 +02:00
|
|
|
}
|
|
|
|
return meta.getAttribute('content');
|
|
|
|
};
|