Update top posts and upvote to pass/get title
This commit is contained in:
parent
92ea370e40
commit
9a66205d80
2 changed files with 8 additions and 15 deletions
|
|
@ -19,8 +19,12 @@
|
|||
const alreadyVoted = btn.hasAttribute("voted");
|
||||
|
||||
const method = alreadyVoted ? "DELETE" : "POST";
|
||||
|
||||
const r = await fetch(`${API}/posts/${slug}/vote`, {
|
||||
method,
|
||||
body: JSON.stringify({
|
||||
title: document.querySelector('meta[name="title"]').content,
|
||||
}),
|
||||
credentials: "include",
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue