remove csrf

This commit is contained in:
2026-01-19 17:15:34 +01:00
parent 5584299d44
commit f3dba4c483
5 changed files with 0 additions and 127 deletions
-10
View File
@@ -1,26 +1,16 @@
import { AuthStatusRequest, AuthStatusResponse } from "../items";
export const getCsrfToken = (): string | null => {
const match = document.cookie.match(/csrf_token=([^;]+)/);
return match ? decodeURIComponent(match[1]) : null;
};
export const apiFetch = async (
url: string,
options: RequestInit = {}
): Promise<Response> => {
const token = localStorage.getItem("token");
const csrfToken = getCsrfToken();
const headers = new Headers(options.headers);
if (token) {
headers.set("Authorization", `Bearer ${token}`);
}
if (csrfToken) {
headers.set("X-CSRF-Token", csrfToken);
}
const config = {
...options,
headers,