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);
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -67,8 +67,6 @@ export function SearchListPart({ searchQuery }: { searchQuery: string }) {
|
||||
if (state.error) return <SearchSuffix failed />;
|
||||
if (!results) return null;
|
||||
|
||||
// console.log(results);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{results.length > 0 ? (
|
||||
@ -78,13 +76,9 @@ export function SearchListPart({ searchQuery }: { searchQuery: string }) {
|
||||
icon={Icons.SEARCH}
|
||||
/>
|
||||
<MediaGrid>
|
||||
{results.map((v) =>
|
||||
v.poster === undefined ? (
|
||||
""
|
||||
) : (
|
||||
{results.map((v) => (
|
||||
<WatchedMediaCard key={v.id.toString()} media={v} />
|
||||
),
|
||||
)}
|
||||
))}
|
||||
</MediaGrid>
|
||||
</div>
|
||||
) : null}
|
||||
|
Loading…
Reference in New Issue
Block a user