toast timer 추가

This commit is contained in:
focp212@naver.com
2025-10-23 16:35:39 +09:00
parent 372ecfa3f0
commit 20e532bd68
2 changed files with 7 additions and 5 deletions

View File

@@ -80,7 +80,7 @@ export const BillingChargePage = () => {
billingCharge(params).then((rs) => { billingCharge(params).then((rs) => {
snackBar('결제 신청을 성공하였습니다.', function(){ snackBar('결제 신청을 성공하였습니다.', function(){
navigate(PATHS.transaction.billing.list); navigate(PATHS.transaction.billing.list);
}); }, 3000);
}).catch((e: any) => { }).catch((e: any) => {
/* /*

View File

@@ -1,21 +1,23 @@
import { toast } from "react-toastify"; import { toast } from "react-toastify";
export const snackBar = (text: string, callback?: () => void) => { export const snackBar = (text: string, callback?: () => void, timer?: number) => {
toast.dismiss({ containerId: 'snackbar' }); toast.dismiss({ containerId: 'snackbar' });
toast(text, { containerId: 'snackbar' }); toast(text, { containerId: 'snackbar' });
if(!!callback && typeof(callback) === 'function'){ if(!!callback && typeof(callback) === 'function'){
let time = timer || 3000;
setTimeout(() => { setTimeout(() => {
callback(); callback();
}, 3000); }, time);
} }
}; };
export const notiBar = (text: string, callback?: () => void) => { export const notiBar = (text: string, callback?: () => void, timer?: number) => {
toast.dismiss({ containerId: 'notibar' }); toast.dismiss({ containerId: 'notibar' });
toast(text, { containerId: 'notibar' }); toast(text, { containerId: 'notibar' });
if(!!callback && typeof(callback) === 'function'){ if(!!callback && typeof(callback) === 'function'){
let time = timer || 3000;
setTimeout(() => { setTimeout(() => {
callback(); callback();
}, 3000); }, time);
} }
}; };