mirror of https://github.com/status-im/consul.git
ui: Use credentials for all HTTP API requests (#14343)
Adds withCredentials/credentials to all HTTP API requests.
This commit is contained in:
parent
e36650c49c
commit
c06cc60b90
|
@ -0,0 +1,4 @@
|
|||
```release-note:feature
|
||||
ui: Use withCredentials for all HTTP API requests
|
||||
```
|
||||
|
|
@ -210,6 +210,7 @@ export default class HttpService extends Service {
|
|||
return this.settings.findBySlug('token').then(token => {
|
||||
return fetch(`${path}`, {
|
||||
...params,
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
'X-Consul-Token': typeof token.SecretID === 'undefined' ? '' : token.SecretID,
|
||||
...params.headers,
|
||||
|
|
|
@ -27,6 +27,7 @@ export default function(parseHeaders, XHR) {
|
|||
};
|
||||
Object.entries(headers).forEach(([key, value]) => xhr.setRequestHeader(key, value));
|
||||
options.beforeSend(xhr);
|
||||
xhr.withCredentials = true;
|
||||
xhr.send(options.body);
|
||||
return xhr;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue