feat: migrate CartSnackbar to global notification store
This commit is contained in:
@@ -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: 'Товар добавлен в корзину' })
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user