boredgame/src/lib/util/manipulateCollection.ts

14 lines
540 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);
toast.send(`"${game.name}" 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);
toast.send(`Removed "${game.name}" from collection!`, { duration: 3000, type: ToastType.INFO });
2022-07-28 00:05:54 +00:00
}