Skip to content

Commit

Permalink
fix: single watch history item bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kiremitrov123 committed Mar 6, 2023
1 parent 3a3c7d2 commit 88946a4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/services/inplayer.account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export const subscribeToNotifications = async (uuid: string = '', onMessage: (pa
export const updatePersonalShelves: UpdatePersonalShelves = async (payload) => {
const { favorites, history } = payload.externalData;
const externalData = await getCustomerExternalData();
const currentWatchHistoryIds = externalData?.history?.map((e) => e.mediaid);
const currentFavoriteIds = externalData?.favorites?.map((e) => e.mediaid);
const payloadFavoriteIds = favorites?.map((e) => e.mediaid);

Expand All @@ -283,7 +284,8 @@ export const updatePersonalShelves: UpdatePersonalShelves = async (payload) => {
await InPlayer.Account.updateWatchHistory(history.mediaid, history.progress);
}
});
} else {
}
if (!currentWatchHistoryIds?.includes(history.mediaid)) {
await InPlayer.Account.updateWatchHistory(history.mediaid, history.progress);
}
});
Expand Down

0 comments on commit 88946a4

Please sign in to comment.