Restructure; use DaisyUI

This commit is contained in:
Geomitron
2023-11-28 19:50:45 -06:00
parent 49c3f38f99
commit 2eef4d0bee
727 changed files with 1283 additions and 298840 deletions

View File

@@ -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()