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 _siteConfig = _interopRequireDefault(require("@config/siteConfig.json"));
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); }
@ -31,14 +33,21 @@ 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); }
var customGAListener = function customGAListener(siteConfig) {
var googleId = siteConfig.analytics.googleId;
var googleId = null;
_reactGa.default.initialize(googleId);
if (!_siteConfig.default) {
console.log('no site config found for GAListener');
}
var GAListener =
/*#__PURE__*/
function (_React$Component) {
if (_siteConfig.default.analytics) {
googleId = _siteConfig.default.analytics.googleId;
}
_reactGa.default.initialize(googleId);
var GAListener =
/*#__PURE__*/
function (_React$Component) {
function GAListener() {
_classCallCheck(this, GAListener);
@ -70,10 +79,8 @@ var customGAListener = function customGAListener(siteConfig) {
_inherits(GAListener, _React$Component);
return GAListener;
}(_react.default.Component);
}(_react.default.Component);
return (0, _reactRouterDom.withRouter)(GAListener);
};
var _default = (0, _reactRouterDom.withRouter)(GAListener);
var _default = customGAListener;
exports.default = _default;

View file

@ -19,6 +19,8 @@ var _channelCreate = _interopRequireDefault(require("./channelCreate"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// modules
// local modules
var _default = (0, _redux.combineReducers)({
channel: _channel.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 _siteConfig = _interopRequireDefault(require("@config/siteConfig"));
var _siteConfig = _interopRequireDefault(require("@config/siteConfig.json"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

View file

@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
});
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 }; }

View file

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

View file

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

View file

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

View file

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