Fix configs loading #470

Merged
bones7242 merged 15 commits from fix-configs-loading into master 2018-06-07 19:40:01 +02:00
8 changed files with 76 additions and 59 deletions
Showing only changes of commit 5cb421c0e7 - Show all commits

View file

@ -11,6 +11,8 @@ var _reactGa = _interopRequireDefault(require("react-ga"));
var _reactRouterDom = require("react-router-dom"); var _reactRouterDom = require("react-router-dom");
var _siteConfig = _interopRequireDefault(require("@config/siteConfig.json"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
@ -31,49 +33,54 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
var customGAListener = function customGAListener(siteConfig) { var googleId = null;
var googleId = siteConfig.analytics.googleId;
_reactGa.default.initialize(googleId); if (!_siteConfig.default) {
console.log('no site config found for GAListener');
}
var GAListener = if (_siteConfig.default.analytics) {
/*#__PURE__*/ googleId = _siteConfig.default.analytics.googleId;
function (_React$Component) { }
function GAListener() {
_classCallCheck(this, GAListener);
return _possibleConstructorReturn(this, _getPrototypeOf(GAListener).apply(this, arguments)); _reactGa.default.initialize(googleId);
var GAListener =
/*#__PURE__*/
function (_React$Component) {
function GAListener() {
_classCallCheck(this, GAListener);
return _possibleConstructorReturn(this, _getPrototypeOf(GAListener).apply(this, arguments));
}
_createClass(GAListener, [{
key: "componentDidMount",
value: function componentDidMount() {
this.sendPageView(this.props.history.location);
this.props.history.listen(this.sendPageView);
} }
}, {
key: "sendPageView",
value: function sendPageView(location) {
_reactGa.default.set({
page: location.pathname
});
_createClass(GAListener, [{ _reactGa.default.pageview(location.pathname);
key: "componentDidMount", }
value: function componentDidMount() { }, {
this.sendPageView(this.props.history.location); key: "render",
this.props.history.listen(this.sendPageView); value: function render() {
} return this.props.children;
}, { }
key: "sendPageView", }]);
value: function sendPageView(location) {
_reactGa.default.set({
page: location.pathname
});
_reactGa.default.pageview(location.pathname); _inherits(GAListener, _React$Component);
}
}, {
key: "render",
value: function render() {
return this.props.children;
}
}]);
_inherits(GAListener, _React$Component); return GAListener;
}(_react.default.Component);
return GAListener; var _default = (0, _reactRouterDom.withRouter)(GAListener);
}(_react.default.Component);
return (0, _reactRouterDom.withRouter)(GAListener);
};
var _default = customGAListener;
exports.default = _default; exports.default = _default;

View file

@ -19,6 +19,8 @@ var _channelCreate = _interopRequireDefault(require("./channelCreate"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// modules
// local modules
var _default = (0, _redux.combineReducers)({ var _default = (0, _redux.combineReducers)({
channel: _channel.default, channel: _channel.default,
channelCreate: _channelCreate.default, channelCreate: _channelCreate.default,

View file

@ -9,7 +9,7 @@ var actions = _interopRequireWildcard(require("../constants/publish_action_types
var _publish_channel_select_states = require("../constants/publish_channel_select_states"); var _publish_channel_select_states = require("../constants/publish_channel_select_states");
var _siteConfig = _interopRequireDefault(require("@config/siteConfig")); var _siteConfig = _interopRequireDefault(require("@config/siteConfig.json"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

View file

@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.default = void 0; exports.default = void 0;
var _siteConfig = _interopRequireDefault(require("@config/siteConfig")); var _siteConfig = _interopRequireDefault(require("@config/siteConfig.json"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

View file

@ -2,28 +2,34 @@ import React from 'react';
import GoogleAnalytics from 'react-ga'; import GoogleAnalytics from 'react-ga';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
const customGAListener = (siteConfig) => { import siteConfig from '@config/siteConfig.json';
const { analytics: { googleId } } = siteConfig;
GoogleAnalytics.initialize(googleId); let googleId = null;
class GAListener extends React.Component { if (!siteConfig) {
componentDidMount () { console.log('no site config found for GAListener');
this.sendPageView(this.props.history.location); }
this.props.history.listen(this.sendPageView);
}
sendPageView (location) { if (siteConfig.analytics) {
GoogleAnalytics.set({ page: location.pathname }); ({ googleId } = siteConfig.analytics);
GoogleAnalytics.pageview(location.pathname); }
}
render () { GoogleAnalytics.initialize(googleId);
return this.props.children;
}
}
return withRouter(GAListener); class GAListener extends React.Component {
}; componentDidMount () {
this.sendPageView(this.props.history.location);
this.props.history.listen(this.sendPageView);
}
export default customGAListener; sendPageView (location) {
GoogleAnalytics.set({ page: location.pathname });
GoogleAnalytics.pageview(location.pathname);
}
render () {
return this.props.children;
}
}
export default withRouter(GAListener);

View file

@ -1,5 +1,7 @@
// modules
import { combineReducers } from 'redux'; import { combineReducers } from 'redux';
// local modules
import PublishReducer from './publish'; import PublishReducer from './publish';
import ChannelReducer from './channel'; import ChannelReducer from './channel';
import ShowReducer from './show'; import ShowReducer from './show';

View file

@ -1,7 +1,7 @@
import * as actions from '../constants/publish_action_types'; import * as actions from '../constants/publish_action_types';
import { LOGIN } from '../constants/publish_channel_select_states'; import { LOGIN } from '../constants/publish_channel_select_states';
import siteConfig from '@config/siteConfig'; import siteConfig from '@config/siteConfig.json';
// parse inputs // parse inputs
let disabledConfig = false; let disabledConfig = false;

View file

@ -1,4 +1,4 @@
import siteConfig from '@config/siteConfig'; import siteConfig from '@config/siteConfig.json';
let initialState = { let initialState = {
description : 'default description', description : 'default description',