WikiEducationFoundation/WikiEduDashboard

View on GitHub
app/assets/javascripts/components/nav/news/news_notification/notificationUtils.js

Summary

Maintainability
A
0 mins
Test Coverage
D
66%
import { ADD_NEWS_NOTIFICATION } from '~/app/assets/javascripts/constants/news_notification';

export const notificationMessage = (type, message) => ({
  message,
  closable: true,
  type: type === 'Success' ? 'success' : 'error',
});

export const dispatchNotification = (dispatch, type, message) => {
  dispatch({
    type: ADD_NEWS_NOTIFICATION,
    notification: notificationMessage(type, message),
  });
};