Files
talk/client/coral-admin/src/services/notification.js
T
2017-05-31 00:44:16 +07:00

27 lines
555 B
JavaScript

import t from 'coral-framework/services/i18n';
import {toast} from 'react-toastify';
export function success(msg) {
return toast(msg, {type: 'success'});
}
export function error(msg) {
return toast(msg, {type: 'error'});
}
export function info(msg) {
return toast(msg, {type: 'info'});
}
export function showMutationErrors(error) {
console.error(error);
if (error.errors) {
error.errors.forEach((err) => {
toast(
err.translation_key ? t(`error.${err.translation_key}`) : err,
{type: 'error'}
);
});
}
}