mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-08 14:55:07 +00:00
feat: update cancelTopup API call to use PATCH method and enhance success message with topup details ✨
This commit is contained in:
@ -17,13 +17,15 @@ export default function CancelTopupButton({
|
||||
<Button
|
||||
onClick={async () => {
|
||||
setLoading(true);
|
||||
const [error, x] = await tryCatch(cancelTopup({ id: topupId }));
|
||||
console.log(x);
|
||||
const [error, topup] = await tryCatch(cancelTopup({ id: topupId }));
|
||||
if (error) {
|
||||
toast.error(error.message);
|
||||
setLoading(false);
|
||||
} else {
|
||||
toast.success("Topup cancelled successfully!")
|
||||
toast.success("Topup cancelled successfully!", {
|
||||
description: `Your topup of ${topup?.amount} MVR has been cancelled.`,
|
||||
closeButton: true,
|
||||
})
|
||||
router.replace("/top-ups");
|
||||
}
|
||||
}}
|
||||
|
Reference in New Issue
Block a user