mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-11 08:55:08 +01:00
fix missing poster issu sort the movie list
This commit is contained in:
parent
445103958a
commit
986a46f9f0
@ -24,6 +24,17 @@ export async function searchForMedia(query: MWQuery): Promise<MediaItem[]> {
|
|||||||
return formatTMDBMetaToMediaItem(formattedResult);
|
return formatTMDBMetaToMediaItem(formattedResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
cache.set(query, results, 3600); // cache results for 1 hour
|
cache.set(query, results, 3600);
|
||||||
|
|
||||||
|
results.sort((a, b) => {
|
||||||
|
if (a.poster === undefined) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (b.poster === undefined) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
// cache results for 1 hour
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -67,8 +67,6 @@ export function SearchListPart({ searchQuery }: { searchQuery: string }) {
|
|||||||
if (state.error) return <SearchSuffix failed />;
|
if (state.error) return <SearchSuffix failed />;
|
||||||
if (!results) return null;
|
if (!results) return null;
|
||||||
|
|
||||||
// console.log(results);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{results.length > 0 ? (
|
{results.length > 0 ? (
|
||||||
@ -78,13 +76,9 @@ export function SearchListPart({ searchQuery }: { searchQuery: string }) {
|
|||||||
icon={Icons.SEARCH}
|
icon={Icons.SEARCH}
|
||||||
/>
|
/>
|
||||||
<MediaGrid>
|
<MediaGrid>
|
||||||
{results.map((v) =>
|
{results.map((v) => (
|
||||||
v.poster === undefined ? (
|
<WatchedMediaCard key={v.id.toString()} media={v} />
|
||||||
""
|
))}
|
||||||
) : (
|
|
||||||
<WatchedMediaCard key={v.id.toString()} media={v} />
|
|
||||||
),
|
|
||||||
)}
|
|
||||||
</MediaGrid>
|
</MediaGrid>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
Loading…
Reference in New Issue
Block a user