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 = {
|
||||||
...this.state,
|
...this.state,
|
||||||
searchRes,
|
searchRes,
|
||||||
|
@ -411,7 +411,8 @@ export class Search extends Component<any, SearchState> {
|
||||||
{this.selects}
|
{this.selects}
|
||||||
{this.searchForm}
|
{this.searchForm}
|
||||||
{this.displayResults(type)}
|
{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>
|
<span>{i18n.t("no_results")}</span>
|
||||||
)}
|
)}
|
||||||
<Paginator page={page} onChange={this.handlePageChange} />
|
<Paginator page={page} onChange={this.handlePageChange} />
|
||||||
|
@ -861,7 +862,7 @@ export class Search extends Component<any, SearchState> {
|
||||||
const { communityId, creatorId, type, sort, listingType, page } =
|
const { communityId, creatorId, type, sort, listingType, page } =
|
||||||
getSearchQueryParams();
|
getSearchQueryParams();
|
||||||
|
|
||||||
if (q && q !== "") {
|
if (q) {
|
||||||
this.setState({ searchRes: { state: "loading" } });
|
this.setState({ searchRes: { state: "loading" } });
|
||||||
this.setState({
|
this.setState({
|
||||||
searchRes: await HttpService.client.search({
|
searchRes: await HttpService.client.search({
|
||||||
|
@ -992,7 +993,7 @@ export class Search extends Component<any, SearchState> {
|
||||||
i.setState({ searchText: event.target.value });
|
i.setState({ searchText: event.target.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUrl({
|
async updateUrl({
|
||||||
q,
|
q,
|
||||||
type,
|
type,
|
||||||
listingType,
|
listingType,
|
||||||
|
@ -1029,6 +1030,6 @@ export class Search extends Component<any, SearchState> {
|
||||||
|
|
||||||
this.props.history.push(`/search${getQueryString(queryParams)}`);
|
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.
|
* 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 {
|
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", {
|
moment.updateLocale("en", {
|
||||||
|
|
Loading…
Reference in a new issue