mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 20:09:25 +00:00
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:
9
openapi-csrf.ts
Normal file
9
openapi-csrf.ts
Normal 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"),
|
||||
},
|
||||
});
|
Reference in New Issue
Block a user