Skip to content

Instantly share code, notes, and snippets.

@reaganmcf

reaganmcf/api.js Secret

Last active September 3, 2018 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reaganmcf/75bef6e116c5d5ca432395c110f58d84 to your computer and use it in GitHub Desktop.
Save reaganmcf/75bef6e116c5d5ca432395c110f58d84 to your computer and use it in GitHub Desktop.
getChores func added
/**
* Retrieve all chores from the bucket
*/
const getChores = async function() {
const choreData = await choreBucket
.getObjects({})
.then(data => {
return data;
})
.catch(err => {
console.log(err);
return null;
});
let chores = [];
if (!choreData) {
return [];
} else {
choreData.objects.map(item => {
chores.push(item.title);
});
return chores;
}
};
//update module.exports
module.exports = {
getChores
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment