function duplicateNode()

in project/paperbench/paperbench/gui/static/script.js [313:335]


function duplicateNode(taskId) {
    fetch('/duplicate_node', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({ 'node_id': taskId }),
    })
    .then(response => response.json())
    .then(data => {
        if (data.status === 'success') {
            console.log('Node duplicated:', taskId);
            location.reload();
        } else {
            console.error('Error duplicating node:', data.message);
            alert('Failed to duplicate node: ' + data.message);
        }
    })
    .catch(error => {
        console.error('Error duplicating node:', error);
        alert('Failed to duplicate node. Please try again.');
    });
}