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