Project

General

Profile

« Previous | Next » 

Revision 68cd4bba

Added by matanw about 7 years ago

fixes #14178 - Introduce patternfly toast notifications

View differences:

webpack/assets/javascripts/react_app/redux/actions/toasts/index.js
import {
TOASTS_ADD,
TOASTS_HIDE,
TOASTS_DELETE
// TOASTS_STORE_IN_LOCALSTORAGE,
// TOASTS_GET_FROM_LOCALSTORAGE
} from '../../consts';
import { TOASTS_ADD, TOASTS_DELETE, TOASTS_CLEAR } from '../../consts';
const uuidV1 = require('uuid/v1');
// provide mechanism to persist toasts to localStorage
export const addToast = (toast) => {
const payload = Object.assign({}, toast, {visible: true});
export const addToast = toast => {
const key = uuidV1();
return { type: TOASTS_ADD, payload: payload };
return {
type: TOASTS_ADD,
payload: {
key,
message: { ...toast, key }
}
};
};
export const hideToast = (id) => {
const payload = { id };
export const deleteToast = key => ({
type: TOASTS_DELETE,
payload: { key }
});
return { type: TOASTS_HIDE, payload: payload };
};
export const deleteToast = (id) => {
const payload = { id };
return { type: TOASTS_DELETE, payload: payload };
};
export const clearToasts = () => ({ type: TOASTS_CLEAR });

Also available in: Unified diff