mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	Added init-error events
This commit is contained in:
		
							parent
							
								
									8ba685b67a
								
							
						
					
					
						commit
						945f4761d5
					
				| @ -1,5 +1,6 @@ | ||||
| var Reflux          = require('reflux'); | ||||
| var FeatureActions  = require('./FeatureToggleActions'); | ||||
| var ErrorActions    = require('./ErrorActions'); | ||||
| var Timer           = require('../utils/Timer'); | ||||
| var Server          = require('./FeatureToggleServerFacade'); | ||||
| var filter          = require('lodash/collection/filter'); | ||||
| @ -9,7 +10,6 @@ var _archivedToggles = []; | ||||
| 
 | ||||
| // Creates a DataStore
 | ||||
| var FeatureStore = Reflux.createStore({ | ||||
|     //The store should be split in two: toggleStore && archivedToggleStore!
 | ||||
| 
 | ||||
|     // Initial setup
 | ||||
|     init: function() { | ||||
| @ -23,8 +23,15 @@ var FeatureStore = Reflux.createStore({ | ||||
|     loadDataFromServer: function() { | ||||
|         //TODO: this should not be part of the store!
 | ||||
|         Server.getArchivedFeatures(function(err, archivedToggles) { | ||||
| 
 | ||||
|             if(err) { | ||||
|                 ErrorActions.error(err); | ||||
|                 return; | ||||
|             } else { | ||||
|                 _archivedToggles = archivedToggles; | ||||
|       this.trigger(); | ||||
|                 this.trigger(_archivedToggles); | ||||
|             } | ||||
| 
 | ||||
|         }.bind(this)); | ||||
|     }, | ||||
| 
 | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| var Reflux          = require('reflux'); | ||||
| var FeatureActions  = require('./FeatureToggleActions'); | ||||
| var ErrorActions    = require('./ErrorActions'); | ||||
| var Server          = require('./FeatureToggleServerFacade'); | ||||
| var Timer           = require('../utils/Timer'); | ||||
| var filter          = require('lodash/collection/filter'); | ||||
| @ -20,7 +21,7 @@ var FeatureStore = Reflux.createStore({ | ||||
|     this.listenTo(FeatureActions.revive.completed,  this.onRevive); | ||||
| 
 | ||||
|     //TODO: this should not be part of the store!
 | ||||
|     this.timer = new Timer(this.loadDataFromServer, 3*1000); | ||||
|     this.timer = new Timer(this.loadDataFromServer, 30*1000); | ||||
|     this.timer.start(); | ||||
|   }, | ||||
| 
 | ||||
| @ -28,6 +29,7 @@ var FeatureStore = Reflux.createStore({ | ||||
|     //TODO: this should not be part of the store!
 | ||||
|     Server.getFeatures(function(err, featureToggles) { | ||||
|         if(err) { | ||||
|             ErrorActions.error(err); | ||||
|             return; | ||||
|         } else { | ||||
|             this.setToggles(featureToggles); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user