Skip to content
Snippets Groups Projects
Commit c45ca750 authored by xamgore's avatar xamgore
Browse files

Refactor code

Remove parseInt(.., 10)
Move $.post(..., 'json') to $.postJSON
parent 129fca6f
Branches
Tags
No related merge requests found
......@@ -43,24 +43,15 @@ $(function () {
function closeSession() {
$.ajax({
type: "POST",
url: URLdir + "handler/Session/closeSession",
success: function (data) {
$('.popup_overlay').css('display', 'block');
jLogin.focus();
}
});
$.post(URLdir + 'handler/Session/closeSession')
.done(_ => { $('.popup_overlay').show(); jLogin.focus() });
}
function setSessionTimer(time) {
let updateTime = () =>
$.post(URLdir + 'handler/Session/getSessionTime', {})
.done(function (data) {
let wait = parseInt(data, 10);
wait <= 10 ? closeSession() : setSessionTimer(wait - 10);
}, 'json');
$.postJSON(URLdir + 'handler/Session/getSessionTime', {})
.done(wait => (wait <= 10) ? closeSession() : setSessionTimer(wait - 10));
setTimeout(updateTime, 1000 * time);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment