aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2023-01-29 17:13:57 -0600
committerGitHub <noreply@github.com>2023-01-29 17:13:57 -0600
commit4278d95a8923178563f54fbcbb4586638921e665 (patch)
tree1d329879f57f68259c0af92ecd8b73fca6d27f1b /src
parente4cd65bac0b63151babd691f2640bff25cd85a70 (diff)
parentc614a61ea67c54fa77ec4864f04d3e9407479b6b (diff)
downloadslskd-4278d95a8923178563f54fbcbb4586638921e665.tar.gz
Merge pull request #872 from slskd/routes-again
Wrap each set of routes in a Switch
Diffstat (limited to 'src')
-rw-r--r--src/web/src/components/App.js77
1 files changed, 38 insertions, 39 deletions
diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js
index 70d154af..b52a3bdd 100644
--- a/src/web/src/components/App.js
+++ b/src/web/src/components/App.js
@@ -315,50 +315,49 @@ class App extends Component {
</Sidebar>
<Sidebar.Pusher className='app-content'>
<AppContext.Provider value={{ state: applicationState, options: applicationOptions }}>
- <Switch>
- {isAgent ? <>
+ {isAgent ? <Switch>
+ <Route path={`${urlBase}/system/:tab?`} render={
+ (props) => this.withTokenCheck(
+ <System {...props} state={applicationState} options={applicationOptions} />
+ )
+ }/>
+ <Redirect from='*' to={`${urlBase}/system`}/>
+ </Switch> :
+ <Switch>
+ <Route path={`${urlBase}/searches/:id?`} render={(props) =>
+ this.withTokenCheck(<div className='view'>
+ <Searches
+ server={applicationState.server}
+ {...props}
+ />
+ </div>)}
+ />
+ <Route path={`${urlBase}/browse`} render={(props) => this.withTokenCheck(<Browse {...props}/>)}/>
+ <Route path={`${urlBase}/users`} render={(props) =>
+ this.withTokenCheck(<Users {...props}/>)}
+ />
+ <Route path={`${urlBase}/chat`} render={(props) =>
+ this.withTokenCheck(<Chat {...props} state={applicationState}/>)}
+ />
+ <Route path={`${urlBase}/rooms`} render={(props) => this.withTokenCheck(<Rooms {...props}/>)}/>
+ <Route path={`${urlBase}/uploads`} render={
+ (props) =>
+ this.withTokenCheck(<div className='view'><Transfers {...props} direction='upload'/></div>)
+ }/>
+ <Route path={`${urlBase}/downloads`} render={
+ (props) =>
+ this.withTokenCheck(<div className='view'>
+ <Transfers {...props} direction='download' server={applicationState.server}/>
+ </div>)
+ }/>
<Route path={`${urlBase}/system/:tab?`} render={
(props) => this.withTokenCheck(
<System {...props} state={applicationState} options={applicationOptions} />
)
}/>
- <Redirect from='*' to={`${urlBase}/system`}/>
- </> :
- <>
- <Route path={`${urlBase}/searches/:id?`} render={(props) =>
- this.withTokenCheck(<div className='view'>
- <Searches
- server={applicationState.server}
- {...props}
- />
- </div>)}
- />
- <Route path={`${urlBase}/browse`} render={(props) => this.withTokenCheck(<Browse {...props}/>)}/>
- <Route path={`${urlBase}/users`} render={(props) =>
- this.withTokenCheck(<Users {...props}/>)}
- />
- <Route path={`${urlBase}/chat`} render={(props) =>
- this.withTokenCheck(<Chat {...props} state={applicationState}/>)}
- />
- <Route path={`${urlBase}/rooms`} render={(props) => this.withTokenCheck(<Rooms {...props}/>)}/>
- <Route path={`${urlBase}/uploads`} render={
- (props) =>
- this.withTokenCheck(<div className='view'><Transfers {...props} direction='upload'/></div>)
- }/>
- <Route path={`${urlBase}/downloads`} render={
- (props) =>
- this.withTokenCheck(<div className='view'>
- <Transfers {...props} direction='download' server={applicationState.server}/>
- </div>)
- }/>
- <Route path={`${urlBase}/system/:tab?`} render={
- (props) => this.withTokenCheck(
- <System {...props} state={applicationState} options={applicationOptions} />
- )
- }/>
- <Redirect from='*' to={`${urlBase}/searches`}/>
- </>}
- </Switch>
+ <Redirect from='*' to={`${urlBase}/searches`}/>
+ </Switch>
+ }
</AppContext.Provider>
</Sidebar.Pusher>
</Sidebar.Pushable>