fix: don't toggle follow when following back
This commit is contained in:
parent
70ecc6f96e
commit
0256f38e5d
7 changed files with 78 additions and 7 deletions
|
@ -71,7 +71,6 @@
|
|||
("name" "content")
|
||||
("id" "content")
|
||||
("placeholder" "content")
|
||||
("required" "")
|
||||
("minlength" "2")
|
||||
("maxlength" "4096")))
|
||||
(div
|
||||
|
|
|
@ -290,7 +290,7 @@
|
|||
]);
|
||||
|
||||
fetch(
|
||||
\"/api/v1/auth/user/{{ profile.id }}/follow\",
|
||||
\"/api/v1/auth/user/{{ profile.id }}/follow/toggle\",
|
||||
{
|
||||
method: \"POST\",
|
||||
},
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
(script
|
||||
(text "globalThis.toggle_follow_user = async (e) => {
|
||||
await trigger(\"atto::debounce\", [\"users::follow\"]);
|
||||
fetch(\"/api/v1/auth/user/{{ profile.id }}/follow\", {
|
||||
fetch(\"/api/v1/auth/user/{{ profile.id }}/follow/toggle\", {
|
||||
method: \"POST\",
|
||||
})
|
||||
.then((res) => res.json())
|
||||
|
|
|
@ -193,9 +193,13 @@
|
|||
like.classList.add("green");
|
||||
like.querySelector("svg").classList.add("filled");
|
||||
|
||||
dislike.classList.remove("red");
|
||||
if (dislike) {
|
||||
dislike.classList.remove("red");
|
||||
}
|
||||
} else {
|
||||
dislike.classList.add("red");
|
||||
if (dislike) {
|
||||
dislike.classList.add("red");
|
||||
}
|
||||
|
||||
like.classList.remove("green");
|
||||
like.querySelector("svg").classList.remove("filled");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue