Commit fdd744e1 authored by Fabian van den Broek's avatar Fabian van den Broek

WIP including error-handling

parent 15b42ed9
function showError(message) {
$("#alert_box").html("<div class=\"alert alert-danger\" role=\"alert\">"
+ "<strong>" + message + "</strong></div>");
}
var showWarning = function(msg) {
$("#alert_box").html("<div class=\"alert alert-warning\" role=\"alert\">"
+ "<strong>Warning:</strong> " + msg + "</div>");
};
var showSuccess = function(msg) {
$("#alert_box").html("<div class=\"alert alert-success\" role=\"alert\">"
+ msg + "</div>");
};
...@@ -13,22 +13,6 @@ $(function() { ...@@ -13,22 +13,6 @@ $(function() {
} }
} }
function showError(message) {
$("#alert_box").html("<div class=\"alert alert-danger\" role=\"alert\">"
+ "<strong>" + message + "</strong></div>");
}
var showWarning = function(msg) {
$("#alert_box").html("<div class=\"alert alert-warning\" role=\"alert\">"
+ "<strong>Warning:</strong> " + msg + "</div>");
};
var showSuccess = function(msg) {
$("#alert_box").html("<div class=\"alert alert-success\" role=\"alert\">"
+ msg + "</div>");
};
function displayAttributes (attr, translator){ function displayAttributes (attr, translator){
$.each(attr,function(key, value){ $.each(attr,function(key, value){
addTableLine(translator.hasOwnProperty(key)?translator[key]:key, value); addTableLine(translator.hasOwnProperty(key)?translator[key]:key, value);
......
$(function() {
showError(Cookies.get("error"));
});
...@@ -38,6 +38,11 @@ $(function() { ...@@ -38,6 +38,11 @@ $(function() {
$('#form').submit(function(event) { $('#form').submit(function(event) {
console.log("submit pressed"); console.log("submit pressed");
event.preventDefault(); event.preventDefault();
//clear all errors
$(".form-group").removeClass("has-error");
$("#alert_box").empty();
var issuerID = $("#bank-select").prop("value"); var issuerID = $("#bank-select").prop("value");
$.ajax({ $.ajax({
...@@ -49,7 +54,11 @@ $(function() { ...@@ -49,7 +54,11 @@ $(function() {
console.log("redirect to: " + data); console.log("redirect to: " + data);
window.location.replace(data); window.location.replace(data);
}, },
error: error error: function (jqXHR, status, error) {
console.log(jqXHR, status, error);
showError(jqXHR.responseJSON["description"]);
}
}); });
}); });
}); });
......
...@@ -10,13 +10,14 @@ ...@@ -10,13 +10,14 @@
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://privacybydesign.foundation/tomcat/irma_api_server/bower_components/jwt-decode/build/jwt-decode.js"></script> <script type="text/javascript" src="https://privacybydesign.foundation/tomcat/irma_api_server/bower_components/jwt-decode/build/jwt-decode.js"></script>
<script type="text/javascript" src="https://privacybydesign.foundation/tomcat/irma_api_server/client/irma.js"></script> <script type="text/javascript" src="https://privacybydesign.foundation/tomcat/irma_api_server/client/irma.js"></script>
<script type="text/javascript" src="js.cookie.js"></script> <script type="text/javascript" src="JS/js.cookie.js"></script>
<title> Basis attributen laden met iDIN </title> <title> Basis attributen laden met iDIN </title>
<script type="text/javascript" src="jquery-3.2.0.js"></script> <script type="text/javascript" src="JS/jquery-3.2.0.js"></script>
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>--> <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>-->
<script type="text/javascript" src="iDIN-enroll.js"></script> <script type="text/javascript" src="JS/common.js"></script>
<script type="text/javascript" src="JS/iDIN-enroll.js"></script>
</head> </head>
<body> <body>
......
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="JS/js.cookie.js"></script>
<title> Basis attributen laden met iDIN - ERROR </title>
<script type="text/javascript" src="JS/jquery-3.2.0.js"></script>
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>-->
<script type="text/javascript" src="JS/common.js"></script>
<script type="text/javascript" src="JS/iDIN-error.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div id="logo" class="col-xs-12 col-md-8 col-lg-6 col-md-offset-2 col-lg-offset-3">
<hr/>
<a href="#">
<img class="logo-img" src="images/iDIN_logo_64.png" />
</a>
</div>
<div class="col-xs-12 col-md-8 col-lg-6 col-md-offset-2 col-lg-offset-3">
<h2>Foutmelding</h2>
<div id="alert_box"></div>
<p>Keer terug naar de <a href="index.html">iDIN issue pagina</a></p>
<hr />
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
...@@ -12,9 +12,10 @@ ...@@ -12,9 +12,10 @@
<title> IRMA attributen vanuit iDIN </title> <title> IRMA attributen vanuit iDIN </title>
<script type="text/javascript" src="jquery-3.2.0.js"></script> <script type="text/javascript" src="JS/jquery-3.2.0.js"></script>
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>--> <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>-->
<script type="text/javascript" src="iDIN.js"></script> <script type="text/javascript" src="JS/common.js"></script>
<script type="text/javascript" src="JS/iDIN.js"></script>
</head> </head>
<body> <body>
......
Markdown is supported
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