Skip to content

Commit

Permalink
fix: update router link api and retrieve query params from saved sear…
Browse files Browse the repository at this point in the history
…ch URI
  • Loading branch information
caro3801 committed Jul 10, 2024
1 parent 031f090 commit eb41b7b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/pages/UserHistorySavedSearchList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:key="event.id"
class="user-history-saved-search-list__list__item d-inline-flex justify-content-between"
>
<router-link :to="{ path: event.uri }" class="p-3 flex-grow-1 d-block">
<router-link :to="{ name: 'search', query: getSearchParamsQuery(event.uri) }" class="p-3 flex-grow-1 d-block">
<span class="user-history-saved-search-list__list__item__name fw-bold mb-1">
{{ event.name }}
</span>
Expand Down Expand Up @@ -90,10 +90,6 @@ export default {
AppliedSearchFiltersItem,
UserHistorySaveSearchForm
},
filters: {
humanDate,
humanTime
},
props: {
events: {
type: Array
Expand Down Expand Up @@ -125,8 +121,14 @@ export default {
const ignored = ['from', 'size', 'sort', 'field']
return ignored.includes(name) || (name === 'q' && ['', '*'].includes(value))
},
getSearchParamsFromURI(uri) {
return new URLSearchParams(uri.split('?').slice(1).pop())
},
getSearchParamsQuery(uri) {
return Object.fromEntries(this.getSearchParamsFromURI(uri))
},
createFiltersFromURI(uri) {
const urlSearchParams = new URLSearchParams(uri.split('?').slice(1).pop())
const urlSearchParams = this.getSearchParamsFromURI(uri)
const filters = []
for (let [name, value] of urlSearchParams.entries()) {
if (this.isIgnoredFilter({ name, value })) {
Expand Down

0 comments on commit eb41b7b

Please sign in to comment.