From e36ae64c83eddda104940dd9325e044a30f43369 Mon Sep 17 00:00:00 2001 From: Nachtalb Date: Tue, 13 Apr 2021 00:01:00 +0200 Subject: [PATCH] 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. --- client/components/MessageSearchForm.vue | 4 +++- client/components/Windows/SearchResults.vue | 8 ++++---- client/js/router.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/client/components/MessageSearchForm.vue b/client/components/MessageSearchForm.vue index 02dc6d3c..72d78855 100644 --- a/client/components/MessageSearchForm.vue +++ b/client/components/MessageSearchForm.vue @@ -127,7 +127,9 @@ export default { params: { uuid: this.network.uuid, target: this.channel.name, - term: this.searchInput, + }, + query: { + q: this.searchInput, }, }); }, diff --git a/client/components/Windows/SearchResults.vue b/client/components/Windows/SearchResults.vue index 2eb8bf69..f142ec6a 100644 --- a/client/components/Windows/SearchResults.vue +++ b/client/components/Windows/SearchResults.vue @@ -17,7 +17,7 @@
Search results for "{{ $route.params.term }}" in + >Search results for "{{ $route.query.q }}" in {{ $route.params.target }} @@ -148,7 +148,7 @@ export default { "$route.params.target"() { this.doSearch(); }, - "$route.params.term"() { + "$route.query.q"() { this.doSearch(); }, messages() { @@ -195,7 +195,7 @@ export default { socket.emit("search", { networkUuid: this.$route.params.uuid, channelName: this.$route.params.target, - searchTerm: this.$route.params.term, + searchTerm: this.$route.query.q, offset: this.offset, }); }, @@ -209,7 +209,7 @@ export default { socket.emit("search", { networkUuid: this.$route.params.uuid, channelName: this.$route.params.target, - searchTerm: this.$route.params.term, + searchTerm: this.$route.query.q, offset: this.offset + 1, }); }, diff --git a/client/js/router.js b/client/js/router.js index 66cb6a25..108bf4cc 100644 --- a/client/js/router.js +++ b/client/js/router.js @@ -66,7 +66,7 @@ const router = new VueRouter({ }, { name: "SearchResults", - path: "/search/:uuid/:target/:term", + path: "/search/:uuid/:target", component: SearchResults, }, ],