Enable csrf tokens on API routes

* Upgrade openapi-ts
* Migrate openapi-ts settings to new version
* Add csrf token to headers of all API calls
* Force csrf token authentication on API routes
This commit is contained in:
2025-03-03 13:33:58 +01:00
parent b3f67657d7
commit fe417b0c29
5 changed files with 49 additions and 18 deletions

9
openapi-csrf.ts Normal file
View File

@ -0,0 +1,9 @@
import Cookies from "js-cookie";
import type { CreateClientConfig } from "#openapi";
export const createClientConfig: CreateClientConfig = (config) => ({
...config,
headers: {
"X-CSRFToken": Cookies.get("csrftoken"),
},
});