aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers/searchSong.ts
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2026-06-03 09:58:12 -0700
committerPinapelz <yukais@pinapelz.com>2026-06-03 09:58:12 -0700
commit88e2e3d62677f6af58b19d8e5d4d789b96d525db (patch)
tree2934d599fa4ef8c830cddf452fbdf7e787b1ca12 /src/helpers/searchSong.ts
parentb1c92e09707a423b7b5b01ccb60ba59a91d9f055 (diff)
move songs.ts to be entirely server side
Diffstat (limited to 'src/helpers/searchSong.ts')
-rw-r--r--src/helpers/searchSong.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/helpers/searchSong.ts b/src/helpers/searchSong.ts
index 13fa794..9ce36cf 100644
--- a/src/helpers/searchSong.ts
+++ b/src/helpers/searchSong.ts
@@ -1,12 +1,14 @@
-import { songs } from "../constants";
+import { fetchSongs } from "./fetchSongs";
import { Song } from "../types/song";
-export function searchSong(searchTerm: string): Song[] {
+export async function searchSong(searchTerm: string): Promise<Song[]> {
function fuzzyMatch(input: string){
return input.toLowerCase().replace(/[^0-9a-z ]/gi, '');
}
searchTerm = fuzzyMatch(searchTerm);
+ const songs = await fetchSongs();
+
return songs
.filter((song: Song) => {
const songName = fuzzyMatch(song.name);
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage