Upload 2.14
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import axios from "axios";
|
||||
const baseUrl = "http://localhost:3001/persons";
|
||||
|
||||
const getAll = () => {
|
||||
const request = axios.get(baseUrl);
|
||||
return request.then((response) => response.data);
|
||||
};
|
||||
|
||||
const create = (newObject) => {
|
||||
const request = axios.post(baseUrl, newObject);
|
||||
return request.then((response) => response.data);
|
||||
@@ -16,4 +14,9 @@ const update = (id, newObject) => {
|
||||
return request.then((response) => response.data);
|
||||
};
|
||||
|
||||
export default { getAll, create, update };
|
||||
const deletePerson = (id) => {
|
||||
const request = axios.delete(`${baseUrl}/${id}`);
|
||||
return request.then((response) => response);
|
||||
};
|
||||
|
||||
export default { getAll, create, update, deletePerson };
|
||||
|
||||
Reference in New Issue
Block a user