Notifications for events

This commit is contained in:
James Barnsley
2016-12-14 08:29:24 +13:00
parent 2d193ca204
commit e599692c3a
6 changed files with 39 additions and 34 deletions

View File

@ -1,6 +1,6 @@
var actions = require('./actions.js')
var uiActions = require('./actions.js')
var spotifyActions = require('../spotify/actions.js')
var helpers = require('../../helpers.js')
@ -18,7 +18,7 @@ const UIMiddleware = (function(){
// start a timeout to remove this notification
var timeout = setTimeout(
function(){
store.dispatch(actions.removeNotification(action.notification.id))
store.dispatch(uiActions.removeNotification(action.notification.id))
},
3000
)
@ -27,6 +27,14 @@ const UIMiddleware = (function(){
next(action)
break
case 'PLAYLIST_TRACKS_ADDED':
store.dispatch(uiActions.createNotification('Added '+action.tracks_uris.length+' tracks to playlist'))
// we don't want to stop things happening as usual
next(action)
break
// This action is irrelevant to us, pass it on to the next middleware
default:
return next(action)