Update sonner

This commit is contained in:
Anton Gunnarsson
2025-05-07 09:57:54 +02:00
parent 11c1810249
commit 83646d4d02
4 changed files with 16 additions and 23 deletions

View File

@@ -38,15 +38,12 @@ export function useGuaranteePaymentFailedToast() {
if (!errorCode || errorCode === BookingErrorCodeEnum.TransactionCancelled)
return
// setTimeout is needed to show toasts on page load: https://sonner.emilkowal.ski/toast#render-toast-on-page-load
setTimeout(() => {
const toastType =
errorCode === BookingErrorCodeEnum.TransactionCancelled
? "warning"
: "error"
const toastType =
errorCode === BookingErrorCodeEnum.TransactionCancelled
? "warning"
: "error"
toast[toastType](errorMessage)
toast[toastType](errorMessage)
})
const ancillary = searchParams.get("ancillary")
if ((errorCode && ancillary) || errorCode === "AncillaryFailed") {
return

View File

@@ -41,15 +41,11 @@ export function usePaymentFailedToast() {
useEffect(() => {
if (!errorCode) return
// setTimeout is needed to show toasts on page load: https://sonner.emilkowal.ski/toast#render-toast-on-page-load
setTimeout(() => {
const toastType =
errorCode === BookingErrorCodeEnum.TransactionCancelled
? "warning"
: "error"
toast[toastType](errorMessage)
})
const toastType =
errorCode === BookingErrorCodeEnum.TransactionCancelled
? "warning"
: "error"
toast[toastType](errorMessage)
const queryParams = new URLSearchParams(searchParams.toString())
queryParams.delete("errorCode")