This commit is contained in:
QkoSad
2023-08-08 16:02:54 +03:00
commit 0a7a469d56
315 changed files with 426907 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
import axios from "axios";
const baseUrl = "http://localhost:3001/anecdotes";
const getAll = async () => {
const resp = await axios.get(baseUrl);
return resp.data;
};
const create = async (data) => {
const resp = await axios.post(baseUrl, data);
return resp.data;
};
const increaseVote = async (element) => {
const id = element.id;
const newElement = { ...element, votes: element.votes + 1 };
const resp = await axios.put(baseUrl + "/" + id, newElement);
return resp.data
};
export { getAll, create, increaseVote };