aboutsummaryrefslogtreecommitdiff
path: root/src/js/like.js
diff options
context:
space:
mode:
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})`
+ })
+}
+