Prevent dupliate callbacks
This commit is contained in:
parent
5d0c5b1ae3
commit
8e2369eff9
@ -176,6 +176,7 @@ def callback():
|
||||
params = request.get_json()
|
||||
if 'source' not in params and 'itemid' not in params:
|
||||
logger.error("Bad request params: {}".format(params))
|
||||
logger.info('Executing callback for {}/{}'.format(params['source'], params['itemid']))
|
||||
sources.item_callback(params['source'], params['itemid'])
|
||||
return jsonify({})
|
||||
|
||||
|
@ -76,10 +76,11 @@
|
||||
body: JSON.stringify({items: items}),
|
||||
})
|
||||
.then(function () {
|
||||
location.reload()
|
||||
location.reload();
|
||||
});
|
||||
};
|
||||
var callback = function (source, itemid) {
|
||||
document.getElementById(source + "-" + itemid + "-callback").disabled = true;
|
||||
fetch('/callback/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -107,7 +108,7 @@
|
||||
<p>{{item.body|safe}}</p>
|
||||
{% endif %}
|
||||
{% if item.callback %}
|
||||
<p><button onclick="javascript:callback('{{item.source}}', '{{item.id}}')">Callback</button></p>
|
||||
<p><button id="{{item.source}}-{{item.id}}-callback" onclick="javascript:callback('{{item.source}}', '{{item.id}}')">Callback</button></p>
|
||||
{% endif %}
|
||||
</details>
|
||||
{% else %}<span class="item-title">{{item.title}}</span><br>
|
||||
|
Loading…
Reference in New Issue
Block a user