toast timer 추가
This commit is contained in:
@@ -1,21 +1,23 @@
|
||||
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(text, { containerId: 'snackbar' });
|
||||
if(!!callback && typeof(callback) === 'function'){
|
||||
let time = timer || 3000;
|
||||
setTimeout(() => {
|
||||
callback();
|
||||
}, 3000);
|
||||
}, time);
|
||||
}
|
||||
};
|
||||
|
||||
export const notiBar = (text: string, callback?: () => void) => {
|
||||
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();
|
||||
}, 3000);
|
||||
}, time);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user