aboutsummaryrefslogtreecommitdiff
path: root/src/js/like.js
blob: cd1e015958d716714f82188cd24894cfa189cc4d (plain)
1
2
3
4
5
6
7
8
9
10
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})`
        })
}