Files
nice-app-web/src/shared/lib/toast.ts
focp212@naver.com 20e532bd68 toast timer 추가
2025-10-23 16:35:39 +09:00

23 lines
674 B
TypeScript

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