Fixed search and websocket debug
This commit is contained in:
@@ -1,15 +1,12 @@
|
||||
import { ref } from '@vue/composition-api'
|
||||
import { socket } from '@/utils/socket'
|
||||
import { get } from '@/utils/api'
|
||||
|
||||
const searchResult = ref({})
|
||||
|
||||
function performMainSearch(searchTerm) {
|
||||
socket.emit('mainSearch', { term: searchTerm })
|
||||
|
||||
socket.on('mainSearch', data => {
|
||||
get('mainSearch', { term: searchTerm })
|
||||
.then(data => {
|
||||
searchResult.value = data
|
||||
|
||||
socket.off('mainSearch')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
import { ref } from '@vue/composition-api'
|
||||
import { socket } from '@/utils/socket'
|
||||
import { get } from '@/utils/api'
|
||||
|
||||
const result = ref({})
|
||||
|
||||
function performSearch({ term, type, start = 0, nb = 30 }) {
|
||||
socket.emit('search', {
|
||||
get('search', {
|
||||
term,
|
||||
type,
|
||||
start,
|
||||
nb
|
||||
})
|
||||
|
||||
socket.on('search', data => {
|
||||
}).then(data => {
|
||||
result.value = data
|
||||
|
||||
socket.off('search')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user