aboutsummaryrefslogtreecommitdiff
path: root/part2/phonebook/src/services/persons.js
blob: d65f4a33b7cd1896541ac645a4016404dc38b119 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import axios from 'axios'
const baseUrl = 'http://localhost:3001/persons'

const getAll = () => {
  return axios.get(baseUrl)
}

const create = (person) => {
  return axios.post(baseUrl, person)
}

const update = (id, changedPerson) => {
  return axios.put(`${baseUrl}/${id}`, changedPerson)
}

export default { getAll, create, update }