correct redirect to search page, avoid duplicate keys on moviesettingspage

This commit is contained in:
lukas 2021-09-26 22:41:48 +02:00
parent 51ba86d13d
commit be4a7db4a0
2 changed files with 108 additions and 101 deletions

View File

@ -67,6 +67,17 @@ export class HomePage extends React.Component<Props, state> {
this.fetchStartData();
}
render(): JSX.Element {
return (
<Switch>
<Route path='/media/search/:name'>
<SearchHandling />
</Route>
<Route path='/media/'>{this.homepageContent()}</Route>
</Switch>
);
}
/**
* fetch available videos for specified tag
* this function clears all preview elements an reloads gravity with tag
@ -95,20 +106,18 @@ export class HomePage extends React.Component<Props, state> {
});
}
render(): JSX.Element {
/**
* main content of homepage
*/
homepageContent(): JSX.Element {
return (
<>
<Switch>
<Route path='/search/:name'>
<SearchHandling />
</Route>
<Route path='/'>
<PageTitle title='Home Page' subtitle={this.state.subtitle + ' - ' + this.state.selectionnr}>
<form
className={'form-inline ' + style.searchform}
onSubmit={(e): void => {
e.preventDefault();
this.props.history.push('/search/' + this.keyword);
this.props.history.push('/media/search/' + this.keyword);
}}>
<input
data-testid='searchtextfield'
@ -196,8 +205,6 @@ export class HomePage extends React.Component<Props, state> {
<VideoContainer data={this.state.data} />
<div className={style.rightinfo} />
</Route>
</Switch>
</>
);
}

View File

@ -117,8 +117,8 @@ class MovieSettings extends React.Component<Props, state> {
TVShow Reindex
</button>
<div className={style.indextextarea}>
{this.state.text.map((m) => (
<div key={m} className='textarea-element'>
{this.state.text.map((m, i) => (
<div key={i} className='textarea-element'>
{m}
</div>
))}