Commit e6498689 authored by tom's avatar tom

pass csrf token in body again

parent c0b1964b
...@@ -21,11 +21,14 @@ export default function useFetch() { ...@@ -21,11 +21,14 @@ export default function useFetch() {
const reqParams = { const reqParams = {
...params, ...params,
body: params?.method && params?.body && ![ 'GET', 'HEAD' ].includes(params.method) ? body: params?.method && params?.body && ![ 'GET', 'HEAD' ].includes(params.method) ?
JSON.stringify(params.body) : JSON.stringify({
...params.body,
_csrf_token: token,
}) :
undefined, undefined,
headers: { headers: {
...params?.headers, ...params?.headers,
...(token ? { 'x-csrf-token': token } : {}), // ...(token ? { 'x-csrf-token': token } : {}),
}, },
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment