Populate query box from url. Fixes #18.
This commit is contained in:
parent
27bb21d7c1
commit
e774d4d8c3
|
@ -18,6 +18,7 @@ export class Navbar extends Component<any, State> {
|
||||||
|
|
||||||
constructor(props, context) {
|
constructor(props, context) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
|
this.fillSearchField();
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -72,4 +73,13 @@ export class Navbar extends Component<any, State> {
|
||||||
}
|
}
|
||||||
i.setState({ searchParams: searchParams });
|
i.setState({ searchParams: searchParams });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fillSearchField() {
|
||||||
|
let splitPath: Array<string> = this.context.router.route.location.pathname.split("/");
|
||||||
|
if (splitPath.length == 4 && splitPath[1] == 'search')
|
||||||
|
this.state.searchParams = {
|
||||||
|
page: Number(splitPath[3]),
|
||||||
|
q: splitPath[2]
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue