Transform old notification payload shape into new shape

Will eventually have to refactor, but this makes it backwards
compatible for now
pull/10616/head
Alex P 2018-03-02 14:45:53 -08:00 committed by Andrew Watkins
parent 7d180470fc
commit 549dd8969b
1 changed files with 15 additions and 4 deletions

View File

@ -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},
}
}