blob: 1da7de416d443817dfb43a0955d8db9768c4505f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
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)
}
const remove = (id) => {
return axios.delete(`${baseUrl}/${id}`)
}
export default { getAll, create, update, remove }
|