wisemapping-frontend/packages/webapp/src/utils.ts

16 lines
406 B
TypeScript
Raw Normal View History

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) {
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) {
return '';
2022-07-13 03:45:36 +02:00
}
return meta.getAttribute('content');
};