mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-02-25 00:44:52 +01:00
this is mostly to avoid being greeted by a popup when you leave the app open and it is unable to auto-update every few minutes
33 lines
1.1 KiB
HTML
33 lines
1.1 KiB
HTML
{% load i18n %}
|
|
<script type="text/hyperscript">
|
|
behavior htmx_error_handler
|
|
on htmx:responseError or htmx:afterRequest[detail.failed] or htmx:sendError queue none
|
|
-- Check if the event detail contains the xhr object and the status is 403
|
|
if event.detail.xhr.status == 403 then
|
|
call Swal.fire({
|
|
title: '{% trans "Access Denied" %}',
|
|
text: '{% trans "You do not have permission to perform this action or access this resource." %}',
|
|
icon: 'warning',
|
|
timer: 60000,
|
|
customClass: {
|
|
confirmButton: 'btn btn-warning' -- Optional: different button style
|
|
},
|
|
buttonsStyling: true
|
|
})
|
|
else
|
|
call Swal.fire({
|
|
title: '{% trans "Something went wrong loading your data" %}',
|
|
text: '{% trans "Try reloading the page or check the console for more information." %}',
|
|
icon: 'error',
|
|
timer: 60000,
|
|
customClass: {
|
|
confirmButton: 'btn btn-primary'
|
|
},
|
|
buttonsStyling: true
|
|
})
|
|
end
|
|
then log event
|
|
then halt the event
|
|
end
|
|
</script>
|