feat: new nav

This commit is contained in:
ner committed 2024-08-29 12:58:49 +03:00
1 parent 5733bc0af0
commit 750d5b12c8
25 files changed
+386 -325

No files matched your search

+11
View File
@@ -43,4 +43,15 @@ export const useFavoritesMutation = () => {
};
};
export const useFavoriteToggle = (movie: Movie) => {
const { add, remove } = useFavoritesMutation();
const { map } = useFavorites();
const isFavorite = map.has(movie.id);
const toggle = () => (isFavorite ? remove(movie.id) : add(movie));
return { isFavorite, toggle };
};
export default useFavorites;