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(); 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 * fetch available videos for specified tag
* this function clears all preview elements an reloads gravity with 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 ( return (
<> <>
<Switch>
<Route path='/search/:name'>
<SearchHandling />
</Route>
<Route path='/'>
<PageTitle title='Home Page' subtitle={this.state.subtitle + ' - ' + this.state.selectionnr}> <PageTitle title='Home Page' subtitle={this.state.subtitle + ' - ' + this.state.selectionnr}>
<form <form
className={'form-inline ' + style.searchform} className={'form-inline ' + style.searchform}
onSubmit={(e): void => { onSubmit={(e): void => {
e.preventDefault(); e.preventDefault();
this.props.history.push('/search/' + this.keyword); this.props.history.push('/media/search/' + this.keyword);
}}> }}>
<input <input
data-testid='searchtextfield' data-testid='searchtextfield'
@ -196,8 +205,6 @@ export class HomePage extends React.Component<Props, state> {
<VideoContainer data={this.state.data} /> <VideoContainer data={this.state.data} />
<div className={style.rightinfo} /> <div className={style.rightinfo} />
</Route>
</Switch>
</> </>
); );
} }

View File

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