code.gitea.io/gitea@v1.22.3/web_src/js/htmx.js (about) 1 import * as htmx from 'htmx.org'; 2 import {showErrorToast} from './modules/toast.js'; 3 4 // https://github.com/bigskysoftware/idiomorph#htmx 5 import 'idiomorph/dist/idiomorph-ext.js'; 6 7 // https://htmx.org/reference/#config 8 htmx.config.requestClass = 'is-loading'; 9 htmx.config.scrollIntoViewOnBoost = false; 10 11 // https://htmx.org/events/#htmx:sendError 12 document.body.addEventListener('htmx:sendError', (event) => { 13 // TODO: add translations 14 showErrorToast(`Network error when calling ${event.detail.requestConfig.path}`); 15 }); 16 17 // https://htmx.org/events/#htmx:responseError 18 document.body.addEventListener('htmx:responseError', (event) => { 19 // TODO: add translations 20 showErrorToast(`Error ${event.detail.xhr.status} when calling ${event.detail.requestConfig.path}`); 21 });