diff --git a/.eslintrc b/.eslintrc
index fa3aca98..2312f48f 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -5,6 +5,7 @@
"es6": true
},
"rules": {
+ "new-cap": [2, {newIsCap: true, capIsNew: false}],
"quotes": [2, "single"],
"eol-last": [0],
"no-mixed-requires": [0],
@@ -34,7 +35,8 @@
"globals": {
"Intercom": true,
"fetch": true,
- "require": true
+ "require": true,
+ "File": true
},
"plugins": [
"react"
diff --git a/index.html b/index.html
index 1b5c26a2..743d01dc 100644
--- a/index.html
+++ b/index.html
@@ -51,8 +51,6 @@
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
-
- ga('create', 'UA-60614729-2', 'auto');
diff --git a/js/actions/coa_actions.js b/js/actions/coa_actions.js
index 9af2841c..7c6f5118 100644
--- a/js/actions/coa_actions.js
+++ b/js/actions/coa_actions.js
@@ -7,7 +7,8 @@ import CoaFetcher from '../fetchers/coa_fetcher';
class CoaActions {
constructor() {
this.generateActions(
- 'updateCoa'
+ 'updateCoa',
+ 'flushCoa'
);
}
@@ -26,9 +27,7 @@ class CoaActions {
this.actions.updateCoa(res.coa);
})
.catch((err) => {
- console.log(err)
console.logGlobal(err);
- this.actions.updateCoa('Something went wrong, please try again later.');
});
}
}
diff --git a/js/actions/edition_list_actions.js b/js/actions/edition_list_actions.js
index 0ab07b34..2d9868c1 100644
--- a/js/actions/edition_list_actions.js
+++ b/js/actions/edition_list_actions.js
@@ -1,6 +1,7 @@
'use strict';
import alt from '../alt';
+import Q from 'q';
import EditionListFetcher from '../fetchers/edition_list_fetcher.js';
@@ -28,7 +29,7 @@ class EditionListActions {
pageSize = 10;
}
- return new Promise((resolve, reject) => {
+ return Q.Promise((resolve, reject) => {
EditionListFetcher
.fetch(pieceId, page, pageSize, orderBy, orderAsc)
.then((res) => {
diff --git a/js/actions/event_actions.js b/js/actions/event_actions.js
new file mode 100644
index 00000000..8f1def9f
--- /dev/null
+++ b/js/actions/event_actions.js
@@ -0,0 +1,19 @@
+'use strict';
+
+import alt from '../alt';
+
+
+class EventActions {
+ constructor() {
+ this.generateActions(
+ 'applicationWillBoot',
+ 'applicationDidBoot',
+ 'profileDidLoad',
+ //'userDidLogin',
+ //'userDidLogout',
+ 'routeDidChange'
+ );
+ }
+}
+
+export default alt.createActions(EventActions);
diff --git a/js/actions/piece_list_actions.js b/js/actions/piece_list_actions.js
index 390dfb98..dfb9bd44 100644
--- a/js/actions/piece_list_actions.js
+++ b/js/actions/piece_list_actions.js
@@ -1,6 +1,7 @@
'use strict';
import alt from '../alt';
+import Q from 'q';
import PieceListFetcher from '../fetchers/piece_list_fetcher';
@@ -29,7 +30,7 @@ class PieceListActions {
// afterwards, we can load the list
- return new Promise((resolve, reject) => {
+ return Q.Promise((resolve, reject) => {
PieceListFetcher
.fetch(page, pageSize, search, orderBy, orderAsc)
.then((res) => {
diff --git a/js/actions/user_actions.js b/js/actions/user_actions.js
index 1ea0c560..44682f17 100644
--- a/js/actions/user_actions.js
+++ b/js/actions/user_actions.js
@@ -13,7 +13,7 @@ class UserActions {
}
fetchCurrentUser() {
- UserFetcher.fetchOne()
+ return UserFetcher.fetchOne()
.then((res) => {
this.actions.updateCurrentUser(res.users[0]);
})
diff --git a/js/app.js b/js/app.js
index 13aa38a5..81a8fb82 100644
--- a/js/app.js
+++ b/js/app.js
@@ -5,7 +5,9 @@ require('babel/polyfill');
import React from 'react';
import Router from 'react-router';
+/* eslint-disable */
import fetch from 'isomorphic-fetch';
+/* eslint-enable */
import ApiUrls from './constants/api_urls';
import { updateApiUrls } from './constants/api_urls';
@@ -16,6 +18,16 @@ import requests from './utils/requests';
import { getSubdomainSettings } from './utils/constants_utils';
import { initLogging } from './utils/error_utils';
+import EventActions from './actions/event_actions';
+
+/* eslint-disable */
+// You can comment out the modules you don't need
+// import DebugHandler from './third_party/debug';
+import GoogleAnalyticsHandler from './third_party/ga';
+import RavenHandler from './third_party/raven';
+import IntercomHandler from './third_party/intercom';
+/* eslint-enable */
+
initLogging();
let headers = {
@@ -43,25 +55,30 @@ class AppGateway {
settings = getSubdomainSettings(subdomain);
appConstants.whitelabel = settings;
updateApiUrls(settings.type, subdomain);
- this.load(settings.type);
+ this.load(settings);
} catch(err) {
// if there are no matching subdomains, we're routing
// to the default frontend
console.logGlobal(err);
- this.load('default');
+ this.load();
}
}
- load(type) {
+ load(settings) {
+ let type = 'default';
+ if (settings) {
+ type = settings.type;
+ }
+
+ EventActions.applicationWillBoot(settings);
Router.run(getRoutes(type), Router.HistoryLocation, (App) => {
- if (window.ga) {
- window.ga('send', 'pageview');
- }
React.render(
@@ -433,8 +442,7 @@ let CoaDetails = React.createClass({