Skip to content

Commit

Permalink
Fix likes
Browse files Browse the repository at this point in the history
  • Loading branch information
FroMage committed Jun 17, 2024
1 parent 1985513 commit 85117b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/resources/templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@ <h2 class="footer__title footer__contactTitle">
<script src="/static/javascripts/libs/modernizr/modernizr-custom-webp.js"></script>

<!-- Custom JS -->
<script type="text/javascript">
window.quarkusCsrfHeader = "{inject:csrf.headerName}";
window.quarkusCsrfValue = "{inject:csrf.token}";
</script>
<script src="/static/javascripts/navbar-animated.js"></script>
<script src="/static/javascripts/map.js"></script>
<script src="/static/javascripts/schedule-filter.js"></script>
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/web/static/javascripts/talk-like.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ $(function() {
let likes = _getLikes();
likes.push(id);
_setLikes(likes);
var headers = {};
headers[window.quarkusCsrfHeader] = window.quarkusCsrfValue;

$.ajax({
url: '/like-talk/' + id,
type: 'POST',
headers: headers,
success: function(result) {
$('.js-talksFilter-like[data-talk=' + id + ']').html(result);
},
Expand All @@ -61,10 +64,13 @@ $(function() {
likes.splice(index, 1);
}
_setLikes(likes);
var headers = {};
headers[window.quarkusCsrfHeader] = window.quarkusCsrfValue;

$.ajax({
url: '/unlike-talk/' + id,
type: 'POST',
headers: headers,
success: function(result) {
$('.js-talksFilter-like[data-talk=' + id + ']').html(result);
},
Expand Down

0 comments on commit 85117b1

Please sign in to comment.