Fixed search and websocket debug
This commit is contained in:
parent
632ca94975
commit
c6a2f35fbf
File diff suppressed because one or more lines are too long
@ -1,15 +1,12 @@
|
|||||||
import { ref } from '@vue/composition-api'
|
import { ref } from '@vue/composition-api'
|
||||||
import { socket } from '@/utils/socket'
|
import { get } from '@/utils/api'
|
||||||
|
|
||||||
const searchResult = ref({})
|
const searchResult = ref({})
|
||||||
|
|
||||||
function performMainSearch(searchTerm) {
|
function performMainSearch(searchTerm) {
|
||||||
socket.emit('mainSearch', { term: searchTerm })
|
get('mainSearch', { term: searchTerm })
|
||||||
|
.then(data => {
|
||||||
socket.on('mainSearch', data => {
|
|
||||||
searchResult.value = data
|
searchResult.value = data
|
||||||
|
|
||||||
socket.off('mainSearch')
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,16 @@
|
|||||||
import { ref } from '@vue/composition-api'
|
import { ref } from '@vue/composition-api'
|
||||||
import { socket } from '@/utils/socket'
|
import { get } from '@/utils/api'
|
||||||
|
|
||||||
const result = ref({})
|
const result = ref({})
|
||||||
|
|
||||||
function performSearch({ term, type, start = 0, nb = 30 }) {
|
function performSearch({ term, type, start = 0, nb = 30 }) {
|
||||||
socket.emit('search', {
|
get('search', {
|
||||||
term,
|
term,
|
||||||
type,
|
type,
|
||||||
start,
|
start,
|
||||||
nb
|
nb
|
||||||
})
|
}).then(data => {
|
||||||
|
|
||||||
socket.on('search', data => {
|
|
||||||
result.value = data
|
result.value = data
|
||||||
|
|
||||||
socket.off('search')
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { socket } from '@/utils/socket'
|
import { get } from '@/utils/api'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} url
|
* @param {string} url
|
||||||
@ -7,7 +7,7 @@ import { socket } from '@/utils/socket'
|
|||||||
export function sendAddToQueue(url, bitrate = null) {
|
export function sendAddToQueue(url, bitrate = null) {
|
||||||
if (!url) throw new Error('No URL given to sendAddToQueue function!')
|
if (!url) throw new Error('No URL given to sendAddToQueue function!')
|
||||||
|
|
||||||
socket.emit('addToQueue', { url, bitrate }, () => {})
|
get('addToQueue', { url, bitrate })
|
||||||
}
|
}
|
||||||
|
|
||||||
export function aggregateDownloadLinks(releases) {
|
export function aggregateDownloadLinks(releases) {
|
||||||
|
@ -13,6 +13,7 @@ class CustomSocket extends WebSocket {
|
|||||||
on(key, callback) {
|
on(key, callback) {
|
||||||
this.addEventListener('message', function(event){
|
this.addEventListener('message', function(event){
|
||||||
let data = JSON.parse(event.data)
|
let data = JSON.parse(event.data)
|
||||||
|
console.log(data)
|
||||||
if (data.key == key) callback(data.data)
|
if (data.key == key) callback(data.data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user