Fix search page update url
This commit is contained in:
parent
7832e98214
commit
39745e050a
2 changed files with 9 additions and 8 deletions
|
@ -285,7 +285,7 @@ export class Search extends Component<any, SearchState> {
|
|||
};
|
||||
}
|
||||
|
||||
if (q !== "") {
|
||||
if (q) {
|
||||
this.state = {
|
||||
...this.state,
|
||||
searchRes,
|
||||
|
@ -411,7 +411,8 @@ export class Search extends Component<any, SearchState> {
|
|||
{this.selects}
|
||||
{this.searchForm}
|
||||
{this.displayResults(type)}
|
||||
{this.resultsCount === 0 && this.state.searchRes.state == "success" && (
|
||||
{this.resultsCount === 0 &&
|
||||
this.state.searchRes.state === "success" && (
|
||||
<span>{i18n.t("no_results")}</span>
|
||||
)}
|
||||
<Paginator page={page} onChange={this.handlePageChange} />
|
||||
|
@ -861,7 +862,7 @@ export class Search extends Component<any, SearchState> {
|
|||
const { communityId, creatorId, type, sort, listingType, page } =
|
||||
getSearchQueryParams();
|
||||
|
||||
if (q && q !== "") {
|
||||
if (q) {
|
||||
this.setState({ searchRes: { state: "loading" } });
|
||||
this.setState({
|
||||
searchRes: await HttpService.client.search({
|
||||
|
@ -992,7 +993,7 @@ export class Search extends Component<any, SearchState> {
|
|||
i.setState({ searchText: event.target.value });
|
||||
}
|
||||
|
||||
updateUrl({
|
||||
async updateUrl({
|
||||
q,
|
||||
type,
|
||||
listingType,
|
||||
|
@ -1029,6 +1030,6 @@ export class Search extends Component<any, SearchState> {
|
|||
|
||||
this.props.history.push(`/search${getQueryString(queryParams)}`);
|
||||
|
||||
this.search();
|
||||
await this.search();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1176,7 +1176,7 @@ export function setIsoData(context: any): IsoData {
|
|||
* Tells the node server to load the data from the isoData, or the browser to fetch it.
|
||||
*/
|
||||
export function isInitialRoute(isoData: IsoData, context: any): boolean {
|
||||
return isoData.path == context.router.route.match.url;
|
||||
return isoData.path === context.router.route.match.url;
|
||||
}
|
||||
|
||||
moment.updateLocale("en", {
|
||||
|
|
Loading…
Reference in a new issue