This commit is contained in:
romankko2 committed 2023-04-06 14:49:07 +02:00
1 parent 44ea5c5927
commit 07595eb34a
3 files changed
+30 -21

No files matched your search

+16 -10
View File
@@ -8,7 +8,7 @@
<script>
import { debounce } from 'lodash-es'
import ASearchResultTeam from '@/plugins/lib@search/search/_components/a-search-result-team.vue'
import ASearchResultTasks from '@/plugins/lib@search/search/_components/a-seach-result-task.vue'
import ASearchResultTasks from '@/plugins/lib@search/search/_components/a-search-result-task.vue'
export default {
components: {
@@ -24,21 +24,27 @@ export default {
},
created() {
try {
this.searchResults = this.$axios.get_auth_data('v1/search')
} catch (error) {
this.$toast.error(error)
}
this.$events.on('onSearch', (search) => {
this.search = search
})
},
watch: {
search(newVal) {
this.updateSearchResults(newVal)
}
},
methods: {
debounceSearch: debounce(function () {
this.search()
}, 300),
updateSearchResults: debounce(async function (search) {
try {
this.searchResults = await this.$axios.get_auth(`v1/search?q=${search}`)
// const { mastertasks: mastertasks.data, subtasks: subtasks.data, teams: teams.data}
console.log(this.searchResults)
} catch (error) {
this.$toast.error(error)
}
}, 500)
}
}
</script>