feat(MED-123): show toast on adding analysis to cart
This commit is contained in:
@@ -15,6 +15,7 @@ import { handleAddToCart } from '~/lib/services/medusaCart.service';
|
|||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { InfoTooltip } from '@kit/shared/components/ui/info-tooltip';
|
import { InfoTooltip } from '@kit/shared/components/ui/info-tooltip';
|
||||||
import { Trans } from '@kit/ui/trans';
|
import { Trans } from '@kit/ui/trans';
|
||||||
|
import { toast } from '@kit/ui/sonner';
|
||||||
|
|
||||||
export type OrderAnalysisCard = Pick<
|
export type OrderAnalysisCard = Pick<
|
||||||
StoreProduct, 'title' | 'description' | 'subtitle'
|
StoreProduct, 'title' | 'description' | 'subtitle'
|
||||||
@@ -44,9 +45,11 @@ export default function OrderAnalysesCards({
|
|||||||
selectedVariant: { id: variantId },
|
selectedVariant: { id: variantId },
|
||||||
countryCode,
|
countryCode,
|
||||||
});
|
});
|
||||||
|
toast.success(<Trans i18nKey={'order-analysis:analysisAddedToCart'} />);
|
||||||
setIsAddingToCart(false);
|
setIsAddingToCart(false);
|
||||||
router.push('/home/cart');
|
router.push('/home/cart');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
toast.error(<Trans i18nKey={'order-analysis:analysisAddToCartError'} />);
|
||||||
setIsAddingToCart(false);
|
setIsAddingToCart(false);
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"title": "Select analysis",
|
"title": "Select analysis",
|
||||||
"description": "All analysis results will appear within 1-3 days after the blood test.",
|
"description": "All analysis results will appear within 1-3 days after the blood test.",
|
||||||
"analysisNotAvailable": "Analysis is not available currently"
|
"analysisNotAvailable": "Analysis is not available currently",
|
||||||
|
"analysisAddedToCart": "Analysis added to cart",
|
||||||
|
"analysisAddToCartError": "Adding analysis to cart failed"
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"title": "Vali analüüs",
|
"title": "Vali analüüs",
|
||||||
"description": "Kõikide analüüside tulemused ilmuvad 1–3 tööpäeva jooksul peale vere andmist.",
|
"description": "Kõikide analüüside tulemused ilmuvad 1–3 tööpäeva jooksul peale vere andmist.",
|
||||||
"analysisNotAvailable": "Analüüsi tellimine ei ole hetkel saadaval"
|
"analysisNotAvailable": "Analüüsi tellimine ei ole hetkel saadaval",
|
||||||
|
"analysisAddedToCart": "Analüüs lisatud ostukorvi",
|
||||||
|
"analysisAddToCartError": "Analüüsi lisamine ostukorvi ebaõnnestus"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user