From d68e817aa6118b06d61e0a65112d9e6b817c3b51 Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Thu, 15 Dec 2016 12:36:37 +0530 Subject: [PATCH] Github issue#561, General: Redirect connectv2.topcoder.com to connect.topcoder.com -- Added redirect to connect from connectv2 --- src/routes.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/routes.jsx b/src/routes.jsx index 67ebc1384..d30c7a702 100644 --- a/src/routes.jsx +++ b/src/routes.jsx @@ -17,6 +17,14 @@ const LoginRedirect = withProps({ redirectTo: `${ACCOUNTS_APP_LOGIN_URL}?retUrl=${window.location.protocol}//${window.location.hostname}${window.location.port ? ':' + window.location.port : ''}` })(RedirectComponent) +const redirectToConnect = (nextState, replace, callback) => { + if(window.location.hostname.indexOf('connectv2') === 0) { + window.location.assign(window.location.href.replace('connectv2', 'connect')) + return + } + callback() +} + const redirectToProject = (nextState, replace, callback) => { const feedId = nextState.params.feedId getFreshToken().then(() => { @@ -50,7 +58,7 @@ const redirectToProject = (nextState, replace, callback) => { } export default ( - window.scrollTo(0, 0)} component={ App }> + window.scrollTo(0, 0)} component={ App } onEnter={ redirectToConnect }>