fullstackopen-notes/parts/2/phoneBook/src/services/personService.js

17 lines
524 B
JavaScript
Raw Normal View History

2025-05-26 00:30:14 +02:00
import axios from "axios";
const getPersons = () => {
return axios.get("http://localhost:3001/persons");
};
const addPerson = (personData) => {
return axios.post("http://localhost:3001/persons", personData);
};
2025-05-27 16:42:59 +02:00
const deletePerson = (personId) => {
return axios.delete(`http://localhost:3001/persons/${personId}`);
};
2025-05-27 16:52:11 +02:00
const updatePerson = (personId, personData) => {
return axios.put(`http://localhost:3001/persons/${personId}`, personData);
};
2025-05-26 00:30:14 +02:00
2025-05-27 16:52:11 +02:00
export default { getPersons, addPerson, deletePerson, updatePerson };