|
|
@ -709,9 +709,7 @@ discoverRoutes.get<{ language: string }, GenreSliderItem[]>(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
discoverRoutes.get<never, WatchlistItem[]>(
|
|
|
|
discoverRoutes.get<never, WatchlistItem[]>('/watchlist', async (req, res) => {
|
|
|
|
'/watchlist',
|
|
|
|
|
|
|
|
async (req, res, next) => {
|
|
|
|
|
|
|
|
const userRepository = getRepository(User);
|
|
|
|
const userRepository = getRepository(User);
|
|
|
|
|
|
|
|
|
|
|
|
const activeUser = await userRepository.findOne({
|
|
|
|
const activeUser = await userRepository.findOne({
|
|
|
@ -720,10 +718,8 @@ discoverRoutes.get<never, WatchlistItem[]>(
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (!activeUser?.plexToken) {
|
|
|
|
if (!activeUser?.plexToken) {
|
|
|
|
return next({
|
|
|
|
// We will just return an empty array if the user has no plex token
|
|
|
|
status: 500,
|
|
|
|
return res.json([]);
|
|
|
|
message: 'Must be a Plex account to use watchlist feature.',
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const plexTV = new PlexTvAPI(activeUser?.plexToken);
|
|
|
|
const plexTV = new PlexTvAPI(activeUser?.plexToken);
|
|
|
@ -731,7 +727,6 @@ discoverRoutes.get<never, WatchlistItem[]>(
|
|
|
|
const watchlist = await plexTV.getWatchlist();
|
|
|
|
const watchlist = await plexTV.getWatchlist();
|
|
|
|
|
|
|
|
|
|
|
|
return res.json(watchlist);
|
|
|
|
return res.json(watchlist);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default discoverRoutes;
|
|
|
|
export default discoverRoutes;
|
|
|
|