fix: message from course page

This commit is contained in:
pateljannat
2021-03-23 19:26:31 +05:30
parent 6433af6613
commit 389254b673
8 changed files with 93 additions and 36 deletions

View File

@@ -13,15 +13,17 @@ var set_likes = function (liked, likes) {
// set initial likes
frappe.ready(() => {
var url_params = new URLSearchParams(window.location.search);
frappe.call('community.www.hackathons.project.like', { project: url_params.get("project"), initial: true }, (data) => {
frappe.call('community.www.hackathons.project.like', { project: get_url_arg().get("project"), initial: true }, (data) => {
set_likes(data.message.action == "Liked", data.message.likes)
})
})
var get_url_arg = () => {
return new URLSearchParams(window.location.search);
}
// like - unlike
$('.btn-like').on('click', (e) => {
frappe.call('community.www.hackathons.project.like', { project: $(e.target).attr("data-project") }, (data) => {
frappe.call('community.www.hackathons.project.like', { project: get_url_arg().get("project") }, (data) => {
set_likes(data.message.action == "Liked", data.message.likes);
});
});