datatable.directory codebase
https://datatable.directory/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
513 B
26 lines
513 B
function busy (yes) {
|
|
$('#draft-busy').css('opacity', yes ? 1 : 0)
|
|
}
|
|
|
|
let loaderHideTimeout;
|
|
|
|
function query (route, data, sucfn, erfn) {
|
|
if (!sucfn) sucfn = () => {}
|
|
if (!erfn) erfn = () => {}
|
|
clearTimeout(loaderHideTimeout)
|
|
busy(true)
|
|
window.axios.post(route, data)
|
|
.then(sucfn)
|
|
.catch((error) => {
|
|
console.error(error.message)
|
|
erfn(error.response.data)
|
|
})
|
|
.finally(() => {
|
|
loaderHideTimeout = setTimeout(() => busy(false), 50)
|
|
})
|
|
}
|
|
|
|
export {
|
|
busy,
|
|
query
|
|
}
|
|
|