Skip to content
Snippets Groups Projects
Commit 49b4c6fb authored by Piotr Gawron's avatar Piotr Gawron
Browse files

provide duration for toast

parent 8647827b
No related branches found
No related tags found
2 merge requests!264Resolve "add support for matomo",!245Resolve "Displaying a prompt message when uploading wrong format of overlay"
import { toast } from 'sonner';
import { Toast } from '@/shared/Toast';
const DEFAULT_DURATION_MS = 5000;
type ShowToastArgs = {
type: 'success' | 'error';
message: string;
duration?: number;
};
export const showToast = (args: ShowToastArgs): void => {
toast.custom(t => (
<Toast message={args.message} onDismiss={() => toast.dismiss(t)} type={args.type} />
));
toast.custom(
t => <Toast message={args.message} onDismiss={() => toast.dismiss(t)} type={args.type} />,
{ duration: args.duration ? args.duration : DEFAULT_DURATION_MS },
);
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment