feat: migrate CartSnackbar to global notification store

This commit is contained in:
Kirill
2026-05-27 21:10:01 +05:00
parent e173977daf
commit 30bb25c416
9 changed files with 14 additions and 206 deletions
@@ -4,7 +4,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'
import { useUnit } from 'effector-react'
import { addToCart } from '@/entities/cart/api/cart-api'
import { $user } from '@/shared/model/auth'
import { cartAdded } from '@/shared/model/cart-notifications'
import { addNotification } from '@/shared/model/notification'
type Props = {
productId: string
@@ -21,7 +21,7 @@ export function AddToCartButton(props: Props) {
mutationFn: () => addToCart({ productId, qty }),
onSuccess: () => {
void qc.invalidateQueries({ queryKey: ['me', 'cart'] })
cartAdded()
addNotification({ type: 'info', message: 'Товар добавлен в корзину' })
},
})