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
+12
View File
@@ -0,0 +1,12 @@
import axios from "axios";
const baseUrl = "http://localhost:3001/anecdotes";
export const getAll = () => axios.get(baseUrl).then((res) => res.data);
export const createAnec = (newAnecdote) =>
axios.post(baseUrl, newAnecdote).then((res) => res.data);
export const vote = (anecdote) =>
axios.put(`${baseUrl}/${anecdote.id}`, {
...anecdote,
votes: anecdote.votes + 1,
});