From 549dd8969b97b14d25101257e05a76b07e2c04da Mon Sep 17 00:00:00 2001 From: Alex P Date: Fri, 2 Mar 2018 14:45:53 -0800 Subject: [PATCH] Transform old notification payload shape into new shape Will eventually have to refactor, but this makes it backwards compatible for now --- ui/src/shared/actions/notifications.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/ui/src/shared/actions/notifications.js b/ui/src/shared/actions/notifications.js index 2bb8162a45..8158829ef5 100644 --- a/ui/src/shared/actions/notifications.js +++ b/ui/src/shared/actions/notifications.js @@ -1,9 +1,20 @@ -export function publishNotification(notification) { +export function publishNotification( + type, + message, + duration = 4000, + icon = 'zap' +) { + // TODO: Refactor where notifications are published from and use correct shape + // This acts as a temporary means to transform the old shape into the new one + const notification = { + type, + message, + duration, + icon, + } return { type: 'PUBLISH_NOTIFICATION', - payload: { - notification, - }, + payload: {notification}, } }