feat: set x-csrf-token header for requests

This commit is contained in:
Wyatt Preul 2018-03-06 04:39:34 -06:00 committed by Sérgio Ramos
parent 4a7956782b
commit b64dbb289d
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
});