Skip to content

Instantly share code, notes, and snippets.

@Porter97
Created April 27, 2020 20:12
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 Porter97/cdeb66cadaf38527171471893e79a631 to your computer and use it in GitHub Desktop.
Save Porter97/cdeb66cadaf38527171471893e79a631 to your computer and use it in GitHub Desktop.
#...
const agent = {
#...
put: (url, form) =>
superagent.put(`${API_ROOT}${url}`).type('form').send(form).then(responseBody),
del: url =>
superagent.del(`${API_ROOT}${url}`).then(responseBody),
};
const Collections = {
get: id =>
agent.get(`/collections/${id}`),
update: (name, description, id) =>
agent.put(`/collections/${id}`, { name, description }),
create: (name, description) =>
agent.post('/collections', { name, description }),
del: id =>
agent.del(`/collections/${id}`)
};
export default {
Auth,
Profile,
Collections
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment