mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-01-16 14:06:39 +01:00
33 lines
1.0 KiB
HTML
33 lines
1.0 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'
|
|
},
|
|
buttonsStyling: false
|
|
})
|
|
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: false
|
|
})
|
|
end
|
|
then log event
|
|
then halt the event
|
|
end
|
|
</script>
|