2022-03-24 07:33:20 +01:00
|
|
|
// @flow
|
|
|
|
import { doToast } from 'redux/actions/notifications';
|
|
|
|
|
2022-05-06 07:31:21 +02:00
|
|
|
export function dispatchToast(
|
|
|
|
dispatch: Dispatch,
|
|
|
|
message: string,
|
|
|
|
subMessage: string = '',
|
|
|
|
duration: 'default' | 'long' = 'default',
|
|
|
|
isError: boolean = true
|
|
|
|
) {
|
|
|
|
return dispatch(doToast({ message, subMessage: subMessage || undefined, duration: duration, isError }));
|
|
|
|
}
|
|
|
|
|
2022-03-24 07:33:20 +01:00
|
|
|
export function doFailedSignatureToast(dispatch: Dispatch, channelName: string) {
|
2022-05-06 07:31:21 +02:00
|
|
|
return dispatchToast(dispatch, __('Unable to verify signature.'), channelName);
|
2022-03-24 07:33:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export function devToast(dispatch: Dispatch, msg: string) {
|
|
|
|
// @if process.env.NODE_ENV!='production'
|
|
|
|
console.error(msg); // eslint-disable-line
|
|
|
|
dispatch(doToast({ isError: true, message: `DEV: ${msg}` }));
|
|
|
|
// @endif
|
|
|
|
}
|