Initial commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
module.exports = {
|
||||
includeCredentials: (tokenFn) => {
|
||||
return ({options}, next) => {
|
||||
if (!options.headers) {
|
||||
options.headers = {}; // Create the headers object if needed.
|
||||
}
|
||||
const token = tokenFn();
|
||||
if (token) {
|
||||
options.headers['Authorization'] = 'Bearer ' + tokenFn();
|
||||
}
|
||||
options.credentials = 'same-origin'; // eslint-disable-line
|
||||
next();
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user