Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_getInitialState() {
let routes = Immutable.fromJS(ConfRoutes)
const contextPath = ConfGlobal.contextPath.split('/').filter((v) => v !== '')
// Add context path to PATH and ALIAS properties if it is set (usually applies in DEV environment)
if (contextPath && contextPath.length > 0) {
routes = routes.map((route) => {
let newRoute = route.set('path', List(contextPath).concat(route.get('path')))
newRoute = newRoute.set('alias', List(contextPath).concat(route.get('alias')))
return newRoute
})
}
return {
routes,
warningsDismissed: false,
}
}
const ContextPath = () => {
if (ENV_CONTEXT_PATH !== null && typeof ENV_CONTEXT_PATH !== 'undefined') {
return ENV_CONTEXT_PATH
} else if (!ConfGlobal.contextPath || ConfGlobal.contextPath.length === 0) {
return ''
}
return ConfGlobal.contextPath
}