show.js 782 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Responsavel por enviar os likes e animar o bagulho
  3. */
  4. const like = (url,de,x) => {
  5. document.querySelector(x).setAttribute("style","transition-duration:1s;opacity:0");
  6. var para = parseInt(de) + 1
  7. fetch(`/likes/?url=${encodeURI(url)}&de=${encodeURI(de)}&para=${encodeURI(para)}`)
  8. .then((response) => {
  9. if(response.status === 200){
  10. console.log("curtiu")
  11. }else{
  12. console.log("deu merda")
  13. }
  14. })
  15. }
  16. const shit = (url,de,x) => {
  17. document.querySelector(x).setAttribute("style","transition-duration:1s;opacity:0");
  18. var para = parseInt(de) - 1
  19. fetch(`/likes/?url=${encodeURI(url)}&de=${encodeURI(de)}&para=${encodeURI(para)}`)
  20. .then((response) => {
  21. if(response.status === 200){
  22. console.log("descurtiu")
  23. }else{
  24. console.log("deu merda")
  25. }
  26. })
  27. }