From f61b79e103be23f09e0fab7763bd72021ccf6caf Mon Sep 17 00:00:00 2001 From: Alok Gupta Date: Sat, 2 Dec 2023 23:16:59 +0530 Subject: [PATCH] Fix: Frontend now reflects advertisement deletion, aligning with backend updates. (#1113) --- .../core/AdvertisementEntry/AdvertisementEntry.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.tsx b/src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.tsx index a98275e646..3896b5ec73 100644 --- a/src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.tsx +++ b/src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.tsx @@ -5,6 +5,7 @@ import { Button, Card, Col, Row, Spinner } from 'react-bootstrap'; import { DELETE_ADVERTISEMENT_BY_ID } from 'GraphQl/Mutations/mutations'; import { useMutation } from '@apollo/client'; import { useTranslation } from 'react-i18next'; +import { ADVERTISEMENTS_GET } from 'GraphQl/Queries/Queries'; interface InterfaceAddOnEntryProps { id: string; name: string; @@ -27,7 +28,9 @@ function advertisementEntry({ }: InterfaceAddOnEntryProps): JSX.Element { const { t } = useTranslation('translation', { keyPrefix: 'advertisement' }); const [buttonLoading, setButtonLoading] = useState(false); - const [deleteAdById] = useMutation(DELETE_ADVERTISEMENT_BY_ID); + const [deleteAdById] = useMutation(DELETE_ADVERTISEMENT_BY_ID, { + refetchQueries: [ADVERTISEMENTS_GET], + }); const onDelete = async (): Promise => { setButtonLoading(true);