From 5243cd49d625886ae8170940823d68c5a58d0251 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 2 Jun 2021 12:19:38 +0200 Subject: [PATCH] add function for enable the join button when an error requesting the token occurs --- .../src/main/resources/static/app.js | 11 ++++++----- openvidu-recording-node/public/app.js | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/openvidu-recording-java/src/main/resources/static/app.js b/openvidu-recording-java/src/main/resources/static/app.js index 711073e0..23d2d03b 100644 --- a/openvidu-recording-java/src/main/resources/static/app.js +++ b/openvidu-recording-java/src/main/resources/static/app.js @@ -174,8 +174,7 @@ function joinSession() { }) .catch(error => { console.warn('There was an error connecting to the session:', error.code, error.message); - document.getElementById("join-btn").disabled = false; - document.getElementById("join-btn").innerHTML = "Join!"; + enableBtn(); }); return false; @@ -186,14 +185,16 @@ function leaveSession() { // --- 9) Leave the session by calling 'disconnect' method over the Session object --- session.disconnect(); - document.getElementById("join-btn").disabled = false; - document.getElementById("join-btn").innerHTML = "Join!"; + enableBtn(); } /* OPENVIDU METHODS */ - +function enableBtn (){ + document.getElementById("join-btn").disabled = false; + document.getElementById("join-btn").innerHTML = "Join!"; +} /* APPLICATION REST METHODS */ diff --git a/openvidu-recording-node/public/app.js b/openvidu-recording-node/public/app.js index ff8f5ca0..c8d1c1c3 100644 --- a/openvidu-recording-node/public/app.js +++ b/openvidu-recording-node/public/app.js @@ -174,8 +174,7 @@ function joinSession() { }) .catch(error => { console.warn('There was an error connecting to the session:', error.code, error.message); - document.getElementById("join-btn").disabled = false; - document.getElementById("join-btn").innerHTML = "Join!"; + enableBtn(); }); return false; @@ -186,14 +185,16 @@ function leaveSession() { // --- 9) Leave the session by calling 'disconnect' method over the Session object --- session.disconnect(); - document.getElementById("join-btn").disabled = false; - document.getElementById("join-btn").innerHTML = "Join!"; + enableBtn(); } /* OPENVIDU METHODS */ - +function enableBtn (){ + document.getElementById("join-btn").disabled = false; + document.getElementById("join-btn").innerHTML = "Join!"; +} /* APPLICATION REST METHODS */