mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 22:29:38 +00:00
Restructure; use DaisyUI
This commit is contained in:
@@ -1,28 +1,15 @@
|
||||
import { SongResult, SongSearch } from '../../shared/interfaces/search.interface'
|
||||
import { IPCInvokeHandler } from '../../shared/IPCHandler'
|
||||
import { serverURL } from '../../shared/Paths'
|
||||
import { SongSearch } from '../../../src-shared/interfaces/search.interface'
|
||||
import { serverURL } from '../../../src-shared/Paths'
|
||||
|
||||
/**
|
||||
* Handles the 'song-search' event.
|
||||
*/
|
||||
class SearchHandler implements IPCInvokeHandler<'song-search'> {
|
||||
event = 'song-search' as const
|
||||
export async function songSearch(search: SongSearch) {
|
||||
const response = await fetch(`https://${serverURL}/api/search`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(search),
|
||||
})
|
||||
|
||||
/**
|
||||
* @returns the top 50 songs that match `search`.
|
||||
*/
|
||||
async handler(search: SongSearch): Promise<SongResult[]> {
|
||||
const response = await fetch(`https://${serverURL}/api/search`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(search),
|
||||
})
|
||||
|
||||
return await response.json()
|
||||
}
|
||||
return await response.json()
|
||||
}
|
||||
|
||||
export const searchHandler = new SearchHandler()
|
||||
|
||||
Reference in New Issue
Block a user