function moveNode()

in project/paperbench/paperbench/gui/static/script.js [223:245]


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