admin: new route to try a flag

This commit is contained in:
nemunaire 2018-12-08 03:13:16 +01:00
parent d89cd2f0ca
commit 5dbf60eaa2
3 changed files with 45 additions and 2 deletions

View file

@ -1210,6 +1210,21 @@ angular.module("FICApp")
}
$rootScope.staticFilesNeedUpdate++;
}
$scope.testFlag = function(flag) {
if (flag.test_str) {
$http({
url: "/api/exercices/" + $routeParams.exerciceId + "/flags/" + flag.id + "/try",
data: {"flag": flag.test_str},
method: "POST"
}).then(function(response) {
flag.test_str = "";
$rootScope.newBox('success', "Flag Ok !");
}, function(response) {
flag.test_str = "";
$rootScope.newBox('danger', 'An error occurs: ', response.data.errmsg);
});
}
}
$scope.inSync = false;
$scope.syncFlags = function() {
$scope.inSync = true;