Refac prepare updating watched state based on progress endpoint

This commit is contained in:
MerlinScheurer
2025-01-30 18:33:46 +01:00
parent 9146ecb82d
commit 43bfa1ab93
6 changed files with 35 additions and 47 deletions

View File

@@ -1,11 +1,23 @@
import APIClient from '../../functions/APIClient';
type VideoProgressResponseType = {
watched: boolean;
duration: number;
duration_str: string;
watched_date: number;
position: number;
youtube_id: string;
};
type VideoProgressProp = {
youtubeId: string;
currentProgress: number;
};
const updateVideoProgressById = async ({ youtubeId, currentProgress }: VideoProgressProp) => {
const updateVideoProgressById = async ({
youtubeId,
currentProgress,
}: VideoProgressProp): Promise<VideoProgressResponseType> => {
return APIClient(`/api/video/${youtubeId}/progress/`, {
method: 'POST',
body: { position: currentProgress },