Initial commit: Kottgard production website code
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
'use client';
|
||||
|
||||
import { Product } from '@/domain/entities';
|
||||
import { container } from '@/application/container';
|
||||
import { useWishlistStore } from '@/infrastructure/persistence/zustand/wishlistStore';
|
||||
|
||||
export function useWishlist() {
|
||||
const items = useWishlistStore((s) => s.items);
|
||||
|
||||
return {
|
||||
items,
|
||||
isInWishlist: (productId: string) =>
|
||||
container.wishlistRepository.isInWishlist(productId),
|
||||
toggleItem: (product: Product) =>
|
||||
container.toggleWishlist.execute(product),
|
||||
removeItem: (productId: string) =>
|
||||
container.wishlistRepository.removeItem(productId),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user