danmu-sim/app/songs/actions.tsx

18 lines
402 B
TypeScript
Raw Normal View History

import {
InternetProviderLyricSearchResponse,
getSearchResults,
} from "@/lib/actions/lyrics";
export async function searchSongs(
_currentState: InternetProviderLyricSearchResponse[],
formData: FormData
): Promise<InternetProviderLyricSearchResponse[]> {
const list = await getSearchResults({
name: formData.get("name") as string,
});
if (list) {
return list;
}
return [];
}