Skip to content

Instantly share code, notes, and snippets.

@jhta
Created July 29, 2015 02:38
Show Gist options
  • Save jhta/bc26a7f7611f8644667b to your computer and use it in GitHub Desktop.
Save jhta/bc26a7f7611f8644667b to your computer and use it in GitHub Desktop.
action
var Dispatcher = require('../dispatchers/dispatcher.js');
var Constants = require('../constants/constants.js');
var API = require("../utils/SpaceAPIUtils");
var ListAPI = require('../utils/ListAPIUtils');
var TaskAPI = require('../utils/TaskAPIUtils');
var RouterContainer = require('../router/router-container');
var SpaceActions = {
loadSpaces( userId, teamId ){
API.getSpacesNew(teamId, ( err, spaces )=>{
if(err)
Dispatcher.handleServerAction({
type: Constants.ERROR_LOADING_SPACES
});
else {
Dispatcher.handleServerAction({
type: Constants.SPACES_LOADED,
spaces: spaces
});
}
})
},
createSpace( userId, teamId, spaceData, redirect=true ){
console.log(spaceData);
API.createSpace( userId, teamId, spaceData, function(err, space){
console.log(space);
if (err) {
Dispatcher.handleServerAction({
type: Constants.ERROR_CREATING_SPACE
});
}
var type = Constants.SPACE_CREATED;
Dispatcher.handleServerAction({
type,
space,
redirect,
userId,
teamId
});
});
},
**** :P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment