Replace Table with responsive Card. Add refresh of token and retry on 401 errors

This commit is contained in:
2019-01-18 14:03:58 +01:00
parent d4f432f422
commit 86486795f6
11 changed files with 230 additions and 248 deletions
+8 -12
View File
@@ -1,15 +1,11 @@
const webAuth = require("../auth").default;
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();
includeCredentials: (uri, options) => {
const token = webAuth.idToken();
if (token) {
options.headers['Authorization'] = 'Bearer ' + token;
}
},
return fetch(uri, options);
}
};