From 0df579e2d950c85be0a22427f58b067cb6eecdc2 Mon Sep 17 00:00:00 2001 From: Alex Weiksnar Date: Thu, 10 Dec 2015 12:06:56 -0600 Subject: [PATCH] Add basename to history for subdirectory deploys --- app/main.cjsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/main.cjsx b/app/main.cjsx index 681aee361f..1a3bb2ee7a 100644 --- a/app/main.cjsx +++ b/app/main.cjsx @@ -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)