lbry-desktop/ui/redux/actions/notifications.js
2020-06-16 09:56:32 -04:00

38 lines
641 B
JavaScript

// @flow
import * as ACTIONS from 'constants/action_types';
import uuid from 'uuid/v4';
export function doToast(params: ToastParams) {
if (!params) {
throw Error("'params' object is required to create a toast notification");
}
return {
type: ACTIONS.CREATE_TOAST,
data: {
id: uuid(),
params,
},
};
}
export function doDismissToast() {
return {
type: ACTIONS.DISMISS_TOAST,
};
}
export function doError(error: string | {}) {
return {
type: ACTIONS.CREATE_ERROR,
data: {
error,
},
};
}
export function doDismissError() {
return {
type: ACTIONS.DISMISS_ERROR,
};
}