Skip to content

Commit

Permalink
fix: send CSRF-Token with GET requests
Browse files Browse the repository at this point in the history
The new api expects this and there's no harm in sending it. Doing so
should make the exam specs pass.
  • Loading branch information
ojeytonwilliams committed May 1, 2024
1 parent dd58e2d commit d45347f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client/src/utils/ajax.ts
Expand Up @@ -36,7 +36,10 @@ export interface ResponseWithData<T> {
// TODO: Might want to handle flash messages as close to the request as possible
// to make use of the Response object (message, status, etc)
async function get<T>(path: string): Promise<ResponseWithData<T>> {
const response = await fetch(`${base}${path}`, defaultOptions);
const response = await fetch(`${base}${path}`, {
...defaultOptions,
headers: { 'CSRF-Token': getCSRFToken() }
});

return combineDataWithResponse(response);
}
Expand Down

0 comments on commit d45347f

Please sign in to comment.