Skip to content

Commit

Permalink
feat: improved login checking in report function; closes #124
Browse files Browse the repository at this point in the history
  • Loading branch information
MagneticNeedle committed Oct 16, 2022
1 parent 9883bee commit 8525b0e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bfportal/core/templates/core/experience_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
</span>
</div>
<div id="reportButtonDropdown"
class="dropdown-content flex flex-col text-center text-md font-medium right-0 w-max rounded-lg absolute text-white"
class="invisible dropdown-content flex flex-col text-center text-md font-medium right-0 w-max rounded-lg absolute text-white"
> <!--left-12 -->
<!-- arrow pointing to report button -->
<div class="flex flex-row justify-end pr-0.5">
Expand Down Expand Up @@ -456,6 +456,7 @@
}

if (csrftoken) {
let fetch_error = true;
menuHider.fadeIn();
fetch(`/api/report/${report_type}/?id={{ page.id }}`, {
method: 'post',
Expand All @@ -466,6 +467,7 @@
},
redirect: "error"
}).then(resp => {
fetch_error = false;
menuHider.fadeOut(
function () {
if (resp.status === 200) {
Expand All @@ -484,7 +486,12 @@
)
}).catch((error) => {
menuHider.fadeOut(function () {
handleAfterFadeOut(false, error.message)
if(fetch_error){
handleAfterFadeOut(false, "Not logged in")
} else {
handleAfterFadeOut(false, error.message)
}

})
})
} else {
Expand Down

0 comments on commit 8525b0e

Please sign in to comment.