<commit_before>import React from 'react'
// polyfill webpack require.ensure
if (typeof require.ensure !== 'function') require.ensure = (d, c) => c(require)

if (process.env.BROWSER) {
  require('~node_modules/font-awesome/scss/font-awesome.scss')
  require('~client/styles/main.scss')
}

import App from '~common/components/app'
import DefaultServerConfig from '../../server/config'
import { route as CustomDomainRoute } from '~mobilizations/pages/custom-domain'

export default function createRoutes (store) {
  const { sourceRequest: { host } } = store.getState()

  // eslint-disable-next-line
  const hasSubdomain = host.match(`(.+)\.${DefaultServerConfig.appDomain}`)

  const root = hasSubdomain ? {
    path: '/',
    component: App,
    getChildRoutes (location, cb) {
      require.ensure([], (require) => {
        cb(null, [
          require('./login').default,
          require('./not-found').default
        ])
      })
    },
    indexRoute: {
      ...CustomDomainRoute(store)
    }
  } : {
    path: '/',
    component: App,
    indexRoute: {
      component: <h1>Hello World</h1>
    }
  }

  return root
}<commit_msg>Accept custom domain to render mobilization too #330<commit_after>import React from 'react'
// polyfill webpack require.ensure
if (typeof require.ensure !== 'function') require.ensure = (d, c) => c(require)

if (process.env.BROWSER) {
  require('~node_modules/font-awesome/scss/font-awesome.scss')
  require('~client/styles/main.scss')
}

import App from '~common/components/app'
import DefaultServerConfig from '../../server/config'
import { route as CustomDomainRoute } from '~mobilizations/pages/custom-domain'

export default function createRoutes (store) {
  const { sourceRequest: { host } } = store.getState()

  // eslint-disable-next-line
  const isSubdomain = host.match(`(.+)\.${DefaultServerConfig.appDomain}`)
  const isDomain = host.match(DefaultServerConfig.appDomain)

  const root = isSubdomain || !isDomain ? {
    path: '/',
    component: App,
    getChildRoutes (location, cb) {
      require.ensure([], (require) => {
        cb(null, [
          require('./login').default,
          require('./not-found').default
        ])
      })
    },
    indexRoute: {
      ...CustomDomainRoute(store)
    }
  } : {
    path: '/',
    component: App,
    indexRoute: {
      component: <h1>Hello World</h1>
    }
  }

  return root
}
{'fraction_non_alphanumeric': 0.15723270440251572, 'fraction_numerical': 0.0029350104821802936, 'mean_word_length': 3.0716723549488054, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6304644', 'n_tokens_mistral': 759, 'n_tokens_neox': 746, 'n_words': 153}