Skip to content

Commit

Permalink
Add basename to history for subdirectory deploys
Browse files Browse the repository at this point in the history
  • Loading branch information
aweiksnar committed Dec 10, 2015
1 parent a574807 commit 0df579e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/main.cjsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
React = require 'react'
ReactDOM = {render} = require 'react-dom'
{Router, Route, Link} = require 'react-router'
{useBasename} = require 'history'
createBrowserHistory = require 'history/lib/createBrowserHistory'
routes = require './router'

routes = require './router'
history = createBrowserHistory()

basename = if process.env.DEPLOY_SUBDIR? then "/panoptes-front-end/#{process.env.DEPLOY_SUBDIR}/" else ''

history = useBasename(createBrowserHistory)({basename})

if process.env.NON_ROOT isnt 'true' and window.location? and window.location.hash isnt ""
window.location.pathname = window.location.hash.slice(1)
Expand Down

0 comments on commit 0df579e

Please sign in to comment.