parent
c378e5fc94
commit
eaf0d5e637
9 changed files with 172 additions and 27 deletions
|
|
@ -16,7 +16,7 @@ export default (mios: MiOS) => {
|
|||
route('/i/messaging/:user', messaging);
|
||||
route('/i/mentions', mentions);
|
||||
route('/post::post', post);
|
||||
route('/search::query', search);
|
||||
route('/search', search);
|
||||
route('/:user', user.bind(null, 'home'));
|
||||
route('/:user/graphs', user.bind(null, 'graphs'));
|
||||
route('/:user/:post', post);
|
||||
|
|
@ -47,7 +47,7 @@ export default (mios: MiOS) => {
|
|||
|
||||
function search(ctx) {
|
||||
const el = document.createElement('mk-search-page');
|
||||
el.setAttribute('query', ctx.params.query);
|
||||
el.setAttribute('query', ctx.querystring.substr(2));
|
||||
mount(el);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
</style>
|
||||
<script>
|
||||
import parse from '../../common/scripts/parse-search-query';
|
||||
|
||||
this.mixin('api');
|
||||
|
||||
this.query = this.opts.query;
|
||||
|
|
@ -45,9 +47,7 @@
|
|||
document.addEventListener('keydown', this.onDocumentKeydown);
|
||||
window.addEventListener('scroll', this.onScroll);
|
||||
|
||||
this.api('posts/search', {
|
||||
query: this.query
|
||||
}).then(posts => {
|
||||
this.api('posts/search', parse(this.query)).then(posts => {
|
||||
this.update({
|
||||
isLoading: false,
|
||||
isEmpty: posts.length == 0
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@
|
|||
|
||||
this.onsubmit = e => {
|
||||
e.preventDefault();
|
||||
this.page('/search:' + this.refs.q.value);
|
||||
this.page('/search?q=' + encodeURIComponent(this.refs.q.value));
|
||||
};
|
||||
</script>
|
||||
</mk-ui-header-search>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue