Manage error (#1689)

This commit is contained in:
Christophe Maudoux 2019-04-25 23:03:30 +02:00
parent 6011eaf7b7
commit 239bb4634f
3 changed files with 15 additions and 8 deletions

View File

@ -17,13 +17,16 @@ FavApps = (star) ->
if resp.error
console.log 'Max number reached'
switchStar star, 0
else if resp.result
console.log 'App. registered'
switchStar star, 1
else
console.log 'App. unregistered'
else if resp.error == 0
console.log 'Not authorized'
switchStar star, 0
#error: switchStar star, '0'
else if resp.result
console.log 'App. registered'
switchStar star, 1
else
console.log 'App. unregistered'
switchStar star, 0
error: switchStar star, '0'
switchStar = (star, status) ->
star.attr('src', "#{window.staticPrefix}common/icons/star#{status}.png")

View File

@ -22,6 +22,9 @@ LemonLDAP::NG Favorite Applications script
if (resp.error) {
console.log('Max number reached');
return switchStar(star, 0);
} else if (resp.error === 0) {
console.log('Not authorized');
return switchStar(star, 0);
} else if (resp.result) {
console.log('App. registered');
return switchStar(star, 1);
@ -29,7 +32,8 @@ LemonLDAP::NG Favorite Applications script
console.log('App. unregistered');
return switchStar(star, 0);
}
}
},
error: switchStar(star, '0')
});
};

View File

@ -1 +1 @@
(function(){var FavApps,switchStar;FavApps=function(star){return $.ajax({type:"POST",url:portal+"favapps",data:{app:star.attr("appuri"),logo:star.attr("logo"),desc:star.attr("desc"),title:star.attr("title")},dataType:"json",success:function(resp){if(resp.error){console.log("Max number reached");return switchStar(star,0)}else if(resp.result){console.log("App. registered");return switchStar(star,1)}else{console.log("App. unregistered");return switchStar(star,0)}}})};switchStar=function(star,status){return star.attr("src",window.staticPrefix+"common/icons/star"+status+".png")};$(document).ready(function(){return $("body").on("click",".star",function(){return FavApps($(this))})})}).call(this);
(function(){var FavApps,switchStar;FavApps=function(star){return $.ajax({type:"POST",url:portal+"favapps",data:{app:star.attr("appuri"),logo:star.attr("logo"),desc:star.attr("desc"),title:star.attr("title")},dataType:"json",success:function(resp){if(resp.error){console.log("Max number reached");return switchStar(star,0)}else if(resp.error===0){console.log("Not authorized");return switchStar(star,0)}else if(resp.result){console.log("App. registered");return switchStar(star,1)}else{console.log("App. unregistered");return switchStar(star,0)}},error:switchStar(star,"0")})};switchStar=function(star,status){return star.attr("src",window.staticPrefix+"common/icons/star"+status+".png")};$(document).ready(function(){return $("body").on("click",".star",function(){return FavApps($(this))})})}).call(this);