all files / src/api/ index.js

92.86% Statements 13/14
100% Branches 4/4
80% Functions 4/5
88.89% Lines 8/9
1 branch Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                                
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 })
  }
}