Skip to content

Instantly share code, notes, and snippets.

@jhta
Created July 29, 2015 02:37
Show Gist options
  • Save jhta/94524e44e315fe87ed1a to your computer and use it in GitHub Desktop.
Save jhta/94524e44e315fe87ed1a to your computer and use it in GitHub Desktop.
Util.js
var API = require("../API");
var ListAPI = {
createList(listname, spaceId, cb) {
var data = {
list: { name: listname},
space: { id: spaceId }
};
API.callAjaxPost('/lists', data, ( err, res ) => {
if(err) {
cb(true, null);
} else {
console.log(res);
cb(!res.body.ok, res.body.list);
}
});
},
deleteList( listId, cb ) {
API.callAjaxDelete('/lists/'+listId, ( err, res ) => {
if(err) {
cb(true, null);
} else {
let ok = res.body.ok;
cb(!ok, ok);
}
})
}
}
module.exports = ListAPI;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment