Set X-CSRF-Token for requests

This commit is contained in:
geek 2018-03-05 14:16:56 -06:00
parent 4a7956782b
commit 003c9763a6
2 changed files with 8 additions and 2 deletions

View File

@ -26,7 +26,10 @@ export default (opts = {}) => {
link: new HttpLink({
uri: URI,
credentials: 'same-origin',
fetch
fetch,
headers: {
'X-CSRF-Token': document.cookie.replace(/(?:(?:^|.*;\s*)crumb\s*=\s*([^;]*).*$)|^.*$/, '$1')
}
}),
...opts
});

View File

@ -26,7 +26,10 @@ export default (opts = {}) => {
link: new HttpLink({
uri: URI,
credentials: 'same-origin',
fetch
fetch,
headers: {
'X-CSRF-Token': document.cookie.replace(/(?:(?:^|.*;\s*)crumb\s*=\s*([^;]*).*$)|^.*$/, '$1')
}
}),
...opts
});