Created
July 29, 2015 02:38
-
-
Save jhta/bc26a7f7611f8644667b to your computer and use it in GitHub Desktop.
action
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 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