fullstackopen-notes/parts/2/phoneBook/src/services/personService.js
2025-05-27 16:52:11 +02:00

16 lines
524 B
JavaScript

import axios from "axios";
const getPersons = () => {
return axios.get("http://localhost:3001/persons");
};
const addPerson = (personData) => {
return axios.post("http://localhost:3001/persons", personData);
};
const deletePerson = (personId) => {
return axios.delete(`http://localhost:3001/persons/${personId}`);
};
const updatePerson = (personId, personData) => {
return axios.put(`http://localhost:3001/persons/${personId}`, personData);
};
export default { getPersons, addPerson, deletePerson, updatePerson };