chore: code improvements refactor

This commit is contained in:
Fredrik Burmester
2024-08-09 18:45:53 +02:00
parent c985acb9cd
commit f4e3a28056
11 changed files with 18 additions and 73 deletions

View File

@@ -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;
}
};

View File

@@ -39,6 +39,6 @@ export const reportPlaybackProgress = async ({
{ headers: getAuthHeaders(api) },
);
} catch (error) {
console.log(error);
console.error(error);
}
};

View File

@@ -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,