Skip to content

Commit fb3b049

Browse files
author
vikasrohit
authored
Merge pull request #589 from appirio-tech/feature/connectv2_redirect_connect
Github issue#561, General: Redirect connectv2.topcoder.com to connect.topcoder.com
2 parents 101fee6 + d68e817 commit fb3b049

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/routes.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ const LoginRedirect = withProps({
1717
redirectTo: `${ACCOUNTS_APP_LOGIN_URL}?retUrl=${window.location.protocol}//${window.location.hostname}${window.location.port ? ':' + window.location.port : ''}`
1818
})(RedirectComponent)
1919

20+
const redirectToConnect = (nextState, replace, callback) => {
21+
if(window.location.hostname.indexOf('connectv2') === 0) {
22+
window.location.assign(window.location.href.replace('connectv2', 'connect'))
23+
return
24+
}
25+
callback()
26+
}
27+
2028
const redirectToProject = (nextState, replace, callback) => {
2129
const feedId = nextState.params.feedId
2230
getFreshToken().then(() => {
@@ -50,7 +58,7 @@ const redirectToProject = (nextState, replace, callback) => {
5058
}
5159

5260
export default (
53-
<Route path="/" onUpdate={() => window.scrollTo(0, 0)} component={ App }>
61+
<Route path="/" onUpdate={() => window.scrollTo(0, 0)} component={ App } onEnter={ redirectToConnect }>
5462
<IndexRoute component={Home} />
5563
<Route path="/terms" component={ConnectTerms} />
5664
<Route path="/login" component={LoginRedirect}/>

0 commit comments

Comments
 (0)