MaketRandevu/assets/js/app.js

63 lines
1.8 KiB
JavaScript
Raw Normal View History

2021-11-29 11:01:02 +03:00
/* ----------------------------------------------------------------------------
2022-01-18 15:05:42 +03:00
* Easy!Appointments - Online Appointment Scheduler
2021-11-29 11:01:02 +03:00
*
* @author A.Tselegidis <alextselegidis@gmail.com>
2021-12-18 19:43:45 +03:00
* @copyright Copyright (c) Alex Tselegidis
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
* @link https://easyappointments.org
2021-11-29 11:01:02 +03:00
* @since v1.5.0
* ---------------------------------------------------------------------------- */
/**
* App global namespace object.
*
* This script should be loaded before the other modules in order to define the global application namespace.
*/
2021-11-29 11:01:02 +03:00
window.App = (function () {
function onAjaxError(event, jqXHR, textStatus, errorThrown) {
console.error('Unexpected HTTP Error: ', jqXHR, textStatus, errorThrown);
let response;
try {
response = JSON.parse(jqXHR.responseText); // JSON response
} catch (error) {
response = {message: jqXHR.responseText}; // String response
}
if (!response || !response.message) {
return;
}
if (App.Utils.Message) {
App.Utils.Message.show(lang('unexpected_issues'), lang('unexpected_issues_message'));
$('<div/>', {
'class': 'card',
'html': [
$('<div/>', {
'class': 'card-body overflow-auto',
'html': response.message,
}),
],
}).appendTo('#message-modal .modal-body');
}
}
$(document).ajaxError(onAjaxError);
$(function () {
if (window.moment) {
window.moment.locale(vars('language_code'));
}
});
2021-11-29 11:01:02 +03:00
return {
Components: {},
Http: {},
Layouts: {},
Pages: {},
Utils: {},
2021-11-29 11:01:02 +03:00
};
})();