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

14 lines
381 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-26 00:30:14 +02:00
2025-05-27 16:42:59 +02:00
export default { getPersons, addPerson, deletePerson };