Created
April 6, 2015 21:31
-
-
Save ekryski/7f54f37aa74f70fea1fe to your computer and use it in GitHub Desktop.
Async Flux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AppConstants = require('../constants/constants'); | |
var AppDispatcher = require('../dispatchers/app'); | |
var Connections = require('../api/connection'); | |
var ConnectionActions = { | |
loadConnections: function() { | |
Connections.find({}, function(error, connections){ | |
if (error) { | |
AppDispatcher.handleViewAction({ | |
action: AppConstants.LOAD_CONNECTIONS_FAIL, | |
error: error | |
}); | |
} | |
else { | |
AppDispatcher.handleViewAction({ | |
action: AppConstants.LOAD_CONNECTIONS_SUCCESS, | |
connections: connections | |
}); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment