From 5121e7bf47479dadbe5599761ae422425ea903b1 Mon Sep 17 00:00:00 2001 From: LAHAXE Arnaud Date: Sat, 20 Jul 2019 16:05:51 +0200 Subject: [PATCH] Fix js error on a custom view without require ids --- resources/js/app.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/resources/js/app.js b/resources/js/app.js index 5c06c66..486c74b 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -10,10 +10,12 @@ var u2fClient = { var alert = null; if (data.errorCode) { - alert = document.getElementById('u2f-error'); - alert.innerHTML = errors[data.errorCode]; - alert.classList.toggle('d-none'); - alert.classList.toggle('d-block'); + if (alert) { + alert = document.getElementById('u2f-error'); + alert.innerHTML = errors[data.errorCode]; + alert.classList.toggle('d-none'); + alert.classList.toggle('d-block'); + } return; } @@ -22,8 +24,10 @@ var u2fClient = { var auth = document.getElementById('authentication'); alert = document.getElementById('u2f-success'); - alert.classList.toggle('d-none'); - alert.classList.toggle('d-block'); + if (alert) { + alert.classList.toggle('d-none'); + alert.classList.toggle('d-block'); + } auth.value = JSON.stringify(data); form.submit(); });