feat: new nav
This commit is contained in:
1 parent
5733bc0af0
commit
750d5b12c8
25 files changed
+386
-325
No files matched your search
@@ -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;
|
||||
Reference in new issue
Block a user