refactor: use track instead of song

This commit is contained in:
2024-11-26 22:10:21 +01:00
parent 9fefdf721a
commit 31f31ec2d9
9 changed files with 27 additions and 32 deletions

View File

@@ -0,0 +1,22 @@
import { PlayerClient } from '$lib/proto/player.client';
import { fail } from '@sveltejs/kit';
import { protoTransport } from '../../../hooks.server';
import type { Actions } from './$types';
import { serializable } from '$lib/proto';
import type { PlayTrackResponse } from '$lib/proto/player';
export const actions = {
play: async ({ params }) => {
const client = new PlayerClient(protoTransport);
const response = await client.playTrack({
hash: params.hash
});
if (response.response.track === undefined) {
return fail(500);
}
return serializable<PlayTrackResponse>(response.response);
}
} satisfies Actions;