mirror of
https://gitlab.com/foxixus/neomovies.git
synced 2025-10-27 17:38:50 +05:00
Bug fix: favourites page
This commit is contained in:
@@ -30,7 +30,16 @@ export default function FavoritesPage() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await neoApi.get('/api/v1/favorites');
|
const response = await neoApi.get('/api/v1/favorites');
|
||||||
setFavorites(response.data);
|
const items = Array.isArray(response.data)
|
||||||
|
? response.data.map((m: any) => ({
|
||||||
|
id: m.id,
|
||||||
|
mediaId: String(m.id),
|
||||||
|
mediaType: 'movie' as const,
|
||||||
|
title: m.title ?? m.name ?? '',
|
||||||
|
posterPath: m.poster_path ?? '',
|
||||||
|
}))
|
||||||
|
: [];
|
||||||
|
setFavorites(items);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('Failed to fetch favorites:', error);
|
console.error('Failed to fetch favorites:', error);
|
||||||
// Редиректим только при явном 401
|
// Редиректим только при явном 401
|
||||||
|
|||||||
Reference in New Issue
Block a user