2019-01-18 14:03:58 +01:00
|
|
|
const webAuth = require("../auth").default;
|
|
|
|
|
|
2019-01-15 13:21:24 +01:00
|
|
|
module.exports = {
|
2019-01-18 14:03:58 +01:00
|
|
|
includeCredentials: (uri, options) => {
|
2019-01-22 13:30:41 +01:00
|
|
|
const token = webAuth.accessToken();
|
2019-01-18 14:03:58 +01:00
|
|
|
if (token) {
|
|
|
|
|
options.headers['Authorization'] = 'Bearer ' + token;
|
2019-01-15 13:21:24 +01:00
|
|
|
}
|
2019-01-18 14:03:58 +01:00
|
|
|
return fetch(uri, options);
|
|
|
|
|
}
|
2019-01-15 13:21:24 +01:00
|
|
|
};
|