mirror of
https://github.com/coaidev/coai.git
synced 2025-05-23 23:10:13 +09:00
fix toast
This commit is contained in:
parent
c2668212f6
commit
4951906fcb
@ -29,7 +29,6 @@ import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger
|
||||
|
@ -137,7 +137,7 @@ function dispatch(action: Action) {
|
||||
|
||||
type Toast = Omit<ToasterToast, "id">;
|
||||
|
||||
function toast({ ...props }: Toast) {
|
||||
function toast({ ...props }: Toast, timeout?: number) {
|
||||
const id = genId();
|
||||
|
||||
const update = (props: ToasterToast) =>
|
||||
@ -147,6 +147,8 @@ function toast({ ...props }: Toast) {
|
||||
});
|
||||
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
|
||||
|
||||
setTimeout(dismiss, timeout ?? 5000);
|
||||
|
||||
dispatch({
|
||||
type: "ADD_TOAST",
|
||||
toast: {
|
||||
|
Loading…
Reference in New Issue
Block a user