diff options
| author | JP Dillingham <jp@dillingham.me> | 2023-01-29 08:36:49 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2023-01-29 08:36:49 -0600 |
| commit | c614a61ea67c54fa77ec4864f04d3e9407479b6b (patch) | |
| tree | 1d329879f57f68259c0af92ecd8b73fca6d27f1b | |
| parent | e4cd65bac0b63151babd691f2640bff25cd85a70 (diff) | |
| download | slskd-c614a61ea67c54fa77ec4864f04d3e9407479b6b.tar.gz | |
wrap each set of routes in a Switch
| -rw-r--r-- | src/web/src/components/App.js | 77 |
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> |
