Skip to content

Commit 665582b

Browse files
committed
Revert "Revert "fix: new challenge not working""
This reverts commit 11e561e.
1 parent 11e561e commit 665582b

File tree

1 file changed

+40
-42
lines changed

1 file changed

+40
-42
lines changed

src/routes.js

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -146,56 +146,54 @@ class Routes extends React.Component {
146146

147147
return (
148148
<IdleTimer ref={ref => { this.idleTimer = ref }} timeout={1000 * 60 * IDLE_TIMEOUT_MINUTES} onIdle={this.handleOnIdle} debounce={250}>
149-
<Switch>
150-
{!isAllowed &&
149+
{!isAllowed && <Switch>
151150
<Route exact path='/'
152151
render={() => renderApp(
153152
<Challenges menu='NULL' warnMessage={'You are not authorized to use this application'} />,
154153
<TopBarContainer />,
155154
<Sidebar />
156155
)()}
157-
/>}
158-
159-
{isAllowed && <>
160-
<Route exact path='/'
161-
render={() => renderApp(
162-
<Challenges menu='NULL' />,
163-
<TopBarContainer />,
164-
<Sidebar />
165-
)()}
166-
/>
167-
<Route exact path='/self-service'
168-
render={() => renderApp(
169-
<Challenges selfService />,
170-
<TopBarContainer />,
171-
<Sidebar selfService />
172-
)()}
173-
/>
174-
<Route exact path='/projects/:projectId/challenges/new'
175-
render={({ match }) => renderApp(
176-
<ChallengeEditor />,
177-
<TopBarContainer />,
178-
<Sidebar projectId={match.params.projectId} menu={'New Challenge'} />
179-
)()} />
180-
<Route exact path='/challenges/:challengeId' component={ConnectRedirectToChallenge} />
181-
<Route
182-
path='/projects/:projectId/challenges/:challengeId'
183-
render={({ match }) => renderApp(
184-
<ChallengeEditor />,
185-
<TopBarContainer />,
186-
<Sidebar projectId={match.params.projectId} menu={'New Challenge'} />
187-
)()} />
188-
<Route exact path='/projects/:projectId/challenges'
189-
render={({ match }) => renderApp(
190-
<Challenges projectId={match.params.projectId} />,
191-
<TopBarContainer projectId={match.params.projectId} />,
192-
<Sidebar projectId={match.params.projectId} />
193-
)()} />
194-
</>}
195-
156+
/>
157+
<Redirect to='/' />
158+
</Switch>}
159+
{isAllowed && <Switch>
160+
<Route exact path='/'
161+
render={() => renderApp(
162+
<Challenges menu='NULL' />,
163+
<TopBarContainer />,
164+
<Sidebar />
165+
)()}
166+
/>
167+
<Route exact path='/self-service'
168+
render={() => renderApp(
169+
<Challenges selfService />,
170+
<TopBarContainer />,
171+
<Sidebar selfService />
172+
)()}
173+
/>
174+
<Route exact path='/projects/:projectId/challenges/new'
175+
render={({ match }) => renderApp(
176+
<ChallengeEditor />,
177+
<TopBarContainer />,
178+
<Sidebar projectId={match.params.projectId} menu={'New Challenge'} />
179+
)()} />
180+
<Route exact path='/challenges/:challengeId' component={ConnectRedirectToChallenge} />
181+
<Route
182+
path='/projects/:projectId/challenges/:challengeId'
183+
render={({ match }) => renderApp(
184+
<ChallengeEditor />,
185+
<TopBarContainer />,
186+
<Sidebar projectId={match.params.projectId} menu={'New Challenge'} />
187+
)()} />
188+
<Route exact path='/projects/:projectId/challenges'
189+
render={({ match }) => renderApp(
190+
<Challenges projectId={match.params.projectId} />,
191+
<TopBarContainer projectId={match.params.projectId} />,
192+
<Sidebar projectId={match.params.projectId} />
193+
)()} />
196194
{/* If path is not defined redirect to landing page */}
197195
<Redirect to='/' />
198-
</Switch>
196+
</Switch>}
199197
{this.state.showIdleModal && modal}
200198
</IdleTimer>
201199
)

0 commit comments

Comments
 (0)