From 7450cb1f215701f412370b381c1d3441785493c5 Mon Sep 17 00:00:00 2001 From: meow Date: Wed, 20 Apr 2022 14:52:41 +0300 Subject: [PATCH] default parameters --- assets/js/subscribe_widget.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/assets/js/subscribe_widget.js b/assets/js/subscribe_widget.js index 6f4d90f6f..771235c16 100644 --- a/assets/js/subscribe_widget.js +++ b/assets/js/subscribe_widget.js @@ -10,7 +10,9 @@ if (subscribe_button.getAttribute('data-type') === 'subscribe') { subscribe_button.onclick = unsubscribe; } -function subscribe(retries = 5) { +function subscribe(retries) { + if (retries === undefined) retries = 5; + if (retries <= 0) { console.log('Failed to subscribe.'); return; @@ -50,7 +52,10 @@ function subscribe(retries = 5) { xhr.send('csrf_token=' + subscribe_data.csrf_token); } -function unsubscribe(retries = 5) { +function unsubscribe(retries) { + if (retries === undefined) + retries = 5; + if (retries <= 0) { console.log('Failed to subscribe'); return;