2022-10-31 19:06:27 +00:00
|
|
|
import { wishlistStore } from '$lib/stores/wishlistStore';
|
|
|
|
|
import { toast } from '$lib/components/toast/toast';
|
|
|
|
|
import { ToastType, type GameType, type SavedGameType } from '$lib/types';
|
2022-11-03 05:16:52 +00:00
|
|
|
import { convertToSavedGame } from './gameMapper';
|
2022-10-31 19:06:27 +00:00
|
|
|
|
|
|
|
|
export function addToWishlist(game: GameType | SavedGameType) {
|
|
|
|
|
wishlistStore.add(convertToSavedGame(game));
|
|
|
|
|
toast.send("Added to wishlist", { duration: 3000, type: ToastType.INFO });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function removeFromWishlist(game: GameType | SavedGameType) {
|
|
|
|
|
wishlistStore.remove(game.id);
|
|
|
|
|
toast.send("Removed from wishlist", { duration: 3000, type: ToastType.INFO });
|
|
|
|
|
}
|