Merged in fix/toast-triggering (pull request #475)

fix: issue with toasts not triggering on page load and fix padding issue

Approved-by: Michael Zetterberg
This commit is contained in:
Tobias Johansson
2024-08-23 10:44:35 +00:00
committed by Michael Zetterberg
2 changed files with 20 additions and 14 deletions

View File

@@ -29,21 +29,27 @@ function useAddCardResultToast() {
const error = searchParams.get("error") const error = searchParams.get("error")
if (success) { if (success) {
setTimeout(() => {
toast.success( toast.success(
intl.formatMessage({ id: "Your card was successfully saved!" }) intl.formatMessage({ id: "Your card was successfully saved!" })
) )
})
} else if (cancel) { } else if (cancel) {
setTimeout(() => {
toast.warning( toast.warning(
intl.formatMessage({ intl.formatMessage({
id: "You canceled adding a new credit card.", id: "You canceled adding a new credit card.",
}) })
) )
})
} else if (failure || error) { } else if (failure || error) {
setTimeout(() => {
toast.error( toast.error(
intl.formatMessage({ intl.formatMessage({
id: "Something went wrong and we couldn't add your card. Please try again later.", id: "Something went wrong and we couldn't add your card. Please try again later.",
}) })
) )
})
} }
router.replace(pathname) router.replace(pathname)

View File

@@ -9,7 +9,7 @@
width: var(--width); width: var(--width);
} }
.message { .toast .message {
padding: var(--Spacing-x2) var(--Spacing-x-one-and-half); padding: var(--Spacing-x2) var(--Spacing-x-one-and-half);
} }