Skip to content

Instantly share code, notes, and snippets.

@chudaol

chudaol/index.js Secret

Created November 18, 2016 19:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chudaol/d5176b88ba2c5799c0b7b0dd33ac0426 to your computer and use it in GitHub Desktop.
Save chudaol/d5176b88ba2c5799c0b7b0dd33ac0426 to your computer and use it in GitHub Desktop.
import Vue from 'vue'
import VueResource from 'vue-resource'
Vue.use(VueResource)
const ShoppingListsResource = Vue.resource('http://localhost:3000/' + 'shoppinglists{/id}')
export default {
fetchShoppingLists: () => {
return ShoppingListsResource.get()
},
addNewShoppingList: (data) => {
return ShoppingListsResource.save(data)
},
updateShoppingList: (data) => {
return ShoppingListsResource.update({ id: data.id }, data)
},
deleteShoppingList: (id) => {
return ShoppingListsResource.remove({ id: id })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment