({
- bsod: state.bsod,
user: state.user,
isPopupActive: state.popup.popups.length > 0
}), {
diff --git a/src/polyfills.js b/src/polyfills.js
index e4d74c1..1e0d2a6 100644
--- a/src/polyfills.js
+++ b/src/polyfills.js
@@ -1,2 +1,5 @@
import 'babel-polyfill';
import 'promise.prototype.finally';
+
+// allow :active styles in mobile Safary
+document.addEventListener('touchstart', () => {}, true);
diff --git a/src/services/request.js b/src/services/request.js
index d261814..944b64d 100644
--- a/src/services/request.js
+++ b/src/services/request.js
@@ -54,7 +54,7 @@ export default {
* return a Promise that resolves to the new response.
*/
addMiddleware(middleware) {
- if (!middlewares.find((mdware) => mdware === middleware)) {
+ if (!middlewares.some((mdware) => mdware === middleware)) {
middlewares.push(middleware);
}
}
@@ -62,7 +62,7 @@ export default {
const checkStatus = (resp) => Promise[resp.status >= 200 && resp.status < 300 ? 'resolve' : 'reject'](resp);
-const toJSON = (resp) => resp.json();
+const toJSON = (resp) => resp.json().then((json) => ({...json, originalResponse: resp}));
const rejectWithJSON = (resp) => toJSON(resp).then((resp) => {throw resp;});
const handleResponseSuccess = (resp) => Promise[resp.success || typeof resp.success === 'undefined' ? 'resolve' : 'reject'](resp);
@@ -94,7 +94,7 @@ function runMiddlewares(action, data, restart) {
return middlewares
.filter((middleware) => middleware[action])
.reduce(
- (promise, middleware) => promise.then((resp) => middleware[action](resp, restart)),
+ (promise, middleware) => promise[/^catch|then$/.test(action) ? action : 'then']((resp) => middleware[action](resp, restart)),
Promise[action === 'catch' ? 'reject' : 'resolve'](data)
);
}