Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
toastSuccess = () => toast.update(this.orderToast, { type: toast.TYPE.SUCCESS,autoClose: 3000, render: <div><h4>Order Succesfully Placed</h4><h5>Redirecting to homepage</h5></div>, onClose: () => this.props.history.push('/home') });
toastFail = () => toast.update(this.orderToast, { type: toast.TYPE.ERROR, autoClose: 4000, render: "Something Went Wrong"});
updateToast = (id, options) => {
if (options.text) {
options.render = options.text;
}
if (options.type) {
options.className = options.type + '-toast-background';
}
if (!options.autoClose) {
options.autoClose = 5000;
}
toast.update(id, options);
}
launchNotification = (id) => toast.update(id, { ...this.state.options, render: "Thermonuclear war averted", type: toast.TYPE.SUCCESS });
const update = msg => reactToastify.update(toastId, {render: div(msg)});
const close = () => reactToastify.dismiss(toastId);
function retryErrorNotification() {
var componentProps = {
type: "message",
message: "Message was sent successfully!",
variant: "contained",
color: "success",
};
toast.update(errorToastId, {
render: ,
type: "success",
});
setErrorToastId(null);
}
export const fireLoginPrompt = (history, pathname, text) => {
if (active) {
toast.update(toastId, {
render: ,
autoClose: 5000
});
return;
}
active = true;
toastId = toast.error(, {
onClose: () => active = false,
});
};
export const raiseNotificationToast = (notification: Notification) => {
const component = fetchComponent(notification);
const options: ToastOptions = {
bodyClassName: 'notification-toast-body',
closeButton: ,
position: toast.POSITION.TOP_RIGHT,
progressClassName: `notification-toast-progress-bar`,
toastId: notification.id,
type: ToastType.DEFAULT
};
if (notification.id && toast.isActive(notification.id)) {
const updateOptions = options as UpdateOptions;
updateOptions.render = component;
toast.update(notification.id, options);
}
else {
toast(component, options);
}
};
retryErrorNotification: props => () => {
const componentProps = {
type: "message",
message: "Message was sent successfully!",
variant: "contained",
color: "success",
};
toast.update(props.errorToastId, {
render: ,
type: "success"
});
props.setErrorToastId(null);
}
}),
<input checked="{t}" type="checkbox" id="markascdlc">
)
if (this.toastID == null) {
this.toastID = toast(d(this.toastMarkAsCDLC), {
autoClose: false,
closeOnClick: false,
className: "toast-bg toast-watcher",
onClose: this.dismiss,
});
}
else {
toast.update(this.toastID, {
render: d(this.toastMarkAsCDLC),
});
}
}
if (e.includes('Email already verified')) {
browserHistory.push('/dashboard')
toast.info(e, {
className: 'toast',
autoClose: 2500,
})
} else if (e.includes('Expired token')) {
const message = 'This link has expired. Please login and request a new validation email.'
toast.update(toastId, {
render: message,
type: toast.TYPE.ERROR,
className: 'toast',
autoClose: false,
})
} else
toast.update(toastId, {
render: e,
type: toast.TYPE.ERROR,
autoClose: false,
className: 'toast',
})
}
}