mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
chore: code improvements refactor
This commit is contained in:
@@ -17,14 +17,14 @@ export const markAsNotPlayed = async ({
|
||||
api,
|
||||
itemId,
|
||||
userId,
|
||||
}: MarkAsNotPlayedParams): Promise<boolean> => {
|
||||
}: MarkAsNotPlayedParams): Promise<void> => {
|
||||
if (!api || !itemId || !userId) {
|
||||
console.error("Invalid parameters for markAsNotPlayed");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await api.axiosInstance.delete(
|
||||
await api.axiosInstance.delete(
|
||||
`${api.basePath}/UserPlayedItems/${itemId}`,
|
||||
{
|
||||
params: { userId },
|
||||
@@ -33,8 +33,6 @@ export const markAsNotPlayed = async ({
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
return response.status === 200;
|
||||
} catch (error) {
|
||||
const axiosError = error as AxiosError;
|
||||
console.error(
|
||||
@@ -42,6 +40,6 @@ export const markAsNotPlayed = async ({
|
||||
axiosError.message,
|
||||
axiosError.response?.status,
|
||||
);
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -39,6 +39,6 @@ export const reportPlaybackProgress = async ({
|
||||
{ headers: getAuthHeaders(api) },
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ export const reportPlaybackStopped = async ({
|
||||
}: PlaybackStoppedParams): Promise<void> => {
|
||||
// Validate input parameters
|
||||
if (!api || !sessionId || !itemId || !positionTicks) {
|
||||
console.log("Missing required parameters", {
|
||||
console.error("Missing required parameters", {
|
||||
api,
|
||||
sessionId,
|
||||
itemId,
|
||||
|
||||
Reference in New Issue
Block a user