Update the results after pressing the Back button

This commit is contained in:
Arhey 2022-04-22 02:41:03 +03:00
parent 59dde05ee9
commit f22f3cb680
3 changed files with 40 additions and 15 deletions

View file

@ -1,6 +1,6 @@
<script>
import dayjs from 'dayjs'
import { search, query, hasQuery, channels } from '../store.js'
import { search, query, hasQuery, channels, setSearchParam } from '../store.js'
export let data
export let close
@ -40,9 +40,12 @@
function searchBy(name, value) {
value = value.includes(' ') ? `"${value}"` : value
const q = `${name}:${value}`
query.set(q)
hasQuery.set(true)
search(q)
if($query !== q) {
query.set(q)
hasQuery.set(true)
search(q)
setSearchParam('q', q)
}
close()
}
</script>