Fix configs loading #470
8 changed files with 76 additions and 59 deletions
|
@ -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,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); }
|
||||
|
||||
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) {
|
||||
function GAListener() {
|
||||
_classCallCheck(this, GAListener);
|
||||
if (_siteConfig.default.analytics) {
|
||||
googleId = _siteConfig.default.analytics.googleId;
|
||||
}
|
||||
|
||||
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, [{
|
||||
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
|
||||
});
|
||||
_reactGa.default.pageview(location.pathname);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return this.props.children;
|
||||
}
|
||||
}]);
|
||||
|
||||
_reactGa.default.pageview(location.pathname);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return this.props.children;
|
||||
}
|
||||
}]);
|
||||
_inherits(GAListener, _React$Component);
|
||||
|
||||
_inherits(GAListener, _React$Component);
|
||||
return GAListener;
|
||||
}(_react.default.Component);
|
||||
|
||||
return GAListener;
|
||||
}(_react.default.Component);
|
||||
var _default = (0, _reactRouterDom.withRouter)(GAListener);
|
||||
|
||||
return (0, _reactRouterDom.withRouter)(GAListener);
|
||||
};
|
||||
|
||||
var _default = customGAListener;
|
||||
exports.default = _default;
|
|
@ -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,
|
||||
|
|
|
@ -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 }; }
|
||||
|
||||
|
|
|
@ -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 }; }
|
||||
|
||||
|
|
|
@ -2,28 +2,34 @@ 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 {
|
||||
componentDidMount () {
|
||||
this.sendPageView(this.props.history.location);
|
||||
this.props.history.listen(this.sendPageView);
|
||||
}
|
||||
if (!siteConfig) {
|
||||
console.log('no site config found for GAListener');
|
||||
}
|
||||
|
||||
sendPageView (location) {
|
||||
GoogleAnalytics.set({ page: location.pathname });
|
||||
GoogleAnalytics.pageview(location.pathname);
|
||||
}
|
||||
if (siteConfig.analytics) {
|
||||
({ googleId } = siteConfig.analytics);
|
||||
}
|
||||
|
||||
render () {
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
GoogleAnalytics.initialize(googleId);
|
||||
|
||||
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);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// modules
|
||||
import { combineReducers } from 'redux';
|
||||
|
||||
// local modules
|
||||
import PublishReducer from './publish';
|
||||
import ChannelReducer from './channel';
|
||||
import ShowReducer from './show';
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import siteConfig from '@config/siteConfig';
|
||||
import siteConfig from '@config/siteConfig.json';
|
||||
|
||||
let initialState = {
|
||||
description : 'default description',
|
||||
|
|
Loading…
Reference in a new issue