Replace search term path with query

A search term is dynamic and not a pointer to a resource such as a channel as such it should be a query.

For now the network as well as the channels are still in the path even though we should take them out of there as well (in the case we want a global / network search later on). As for now we can keep in as there is no such filter / facet yet.
This commit is contained in:
Nachtalb 2021-04-13 00:01:00 +02:00
parent be141bea65
commit e36ae64c83
No known key found for this signature in database
GPG Key ID: E48DF13C07055D92
3 changed files with 8 additions and 6 deletions

View File

@ -127,7 +127,9 @@ export default {
params: { params: {
uuid: this.network.uuid, uuid: this.network.uuid,
target: this.channel.name, target: this.channel.name,
term: this.searchInput, },
query: {
q: this.searchInput,
}, },
}); });
}, },

View File

@ -17,7 +17,7 @@
<div class="header"> <div class="header">
<SidebarToggle /> <SidebarToggle />
<span class="title" <span class="title"
>Search results for "{{ $route.params.term }}" in >Search results for "{{ $route.query.q }}" in
{{ $route.params.target }}</span {{ $route.params.target }}</span
> >
<span class="topic"></span> <span class="topic"></span>
@ -148,7 +148,7 @@ export default {
"$route.params.target"() { "$route.params.target"() {
this.doSearch(); this.doSearch();
}, },
"$route.params.term"() { "$route.query.q"() {
this.doSearch(); this.doSearch();
}, },
messages() { messages() {
@ -195,7 +195,7 @@ export default {
socket.emit("search", { socket.emit("search", {
networkUuid: this.$route.params.uuid, networkUuid: this.$route.params.uuid,
channelName: this.$route.params.target, channelName: this.$route.params.target,
searchTerm: this.$route.params.term, searchTerm: this.$route.query.q,
offset: this.offset, offset: this.offset,
}); });
}, },
@ -209,7 +209,7 @@ export default {
socket.emit("search", { socket.emit("search", {
networkUuid: this.$route.params.uuid, networkUuid: this.$route.params.uuid,
channelName: this.$route.params.target, channelName: this.$route.params.target,
searchTerm: this.$route.params.term, searchTerm: this.$route.query.q,
offset: this.offset + 1, offset: this.offset + 1,
}); });
}, },

View File

@ -66,7 +66,7 @@ const router = new VueRouter({
}, },
{ {
name: "SearchResults", name: "SearchResults",
path: "/search/:uuid/:target/:term", path: "/search/:uuid/:target",
component: SearchResults, component: SearchResults,
}, },
], ],