aboutsummaryrefslogtreecommitdiff
path: root/src/js/like.js
diff options
context:
space:
mode:
authorMark Powers <mark@marks.kitchen>2021-02-23 20:09:29 -0600
committerMark Powers <mark@marks.kitchen>2021-02-23 20:09:29 -0600
commit8a0a3a00e75dc2351a7218d0059b87f7e9345871 (patch)
tree180a3dc0065db849301d0e87c11f129475c02eb5 /src/js/like.js
parent4ed0b48232f2d0fdaa1ed85f243119608d2d5caf (diff)
parent5b5dc610bc0da17fd006982de50b4dc74b134a54 (diff)
Merge branch 'master' of marks.kitchen:/srv/git/markskitchen
Diffstat (limited to 'src/js/like.js')
-rw-r--r--src/js/like.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/js/like.js b/src/js/like.js
new file mode 100644
index 0000000..cd1e015
--- /dev/null
+++ b/src/js/like.js
@@ -0,0 +1,11 @@
+function likePost(type, id){
+ fetch(`/post/like/${type}/${id}`)
+ .then(response => response.json())
+ .then(response => {
+ console.log(response)
+ let btn_id=`btn_${type}_${id}`
+ let el = document.getElementById(btn_id)
+ el.innerText = `👍 (${response.likes})`
+ })
+}
+