boredgame/src/lib/util/manipulateCollection.ts

14 lines
508 B
TypeScript
Raw Normal View History

import { collectionStore } from '$lib/stores/collectionStore';
import { toast } from '$lib/components/toast/toast';
import { ToastType, type GameType } from '$lib/types';
export function addToCollection(game: GameType) {
2022-07-28 00:05:54 +00:00
collectionStore.add(game);
2022-07-29 00:34:34 +00:00
toast.send("Added to collection", { duration: 3000, type: ToastType.INFO });
}
export function removeFromCollection(game: GameType) {
2022-07-28 00:05:54 +00:00
collectionStore.remove(game.id);
2022-07-29 00:34:34 +00:00
toast.send("Removed from collection", { duration: 3000, type: ToastType.INFO });
2022-07-28 00:05:54 +00:00
}