blob: d9bdbe52d06fc96b0e50b717f58f331e0b7a9577 (
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/api/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 }
|