Last active
August 29, 2015 14:02
-
-
Save bittersweetryan/d99de162832307e97305 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 checks = evt.check(); | |
var saves = evt.save(); | |
var results = O.concat( checks, saves ); | |
results.subscribe( | |
function(){ | |
... | |
}, | |
function( err ){ | |
} | |
) |
This file contains hidden or 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
evt.check().subscribe( | |
function( results ){ //next | |
if( results.length === 0){ | |
evt.save() | |
.subscribe( | |
function ( result ){ | |
res.send( { | |
success : true, | |
name : name | |
} ); | |
}, | |
function( error ){ | |
res.status( 500 ); | |
res.end( error && error.message ); | |
} | |
); | |
} | |
else{ | |
res.send( { | |
success : false, | |
status : errorCodes.event_exists | |
} ) ; | |
} | |
}, | |
function( error ){ //error | |
res.status( 500 ); | |
res.end( error && error.message ); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment