Skip to content

Commit

Permalink
reset 기능 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
1K3H committed Jul 10, 2020
1 parent b114d67 commit 168064d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app.py
Expand Up @@ -41,5 +41,10 @@ def delete_node():
})
return jsonify({'result':'success'})

@app.route('/reset', methods=['POST'])
def reset():
db.nodes.remove()
return jsonify({'result':'success'})

if __name__ == '__main__':
app.run('0.0.0.0', port=5000, debug=True)
20 changes: 19 additions & 1 deletion templates/index.html
Expand Up @@ -139,7 +139,24 @@
});
};
};


function reset() {
if (confirm("모든 정보가 삭제됩니다. 진행하시겠습니까?")) {
$.ajax({
type: 'POST',
url: '/reset',
success: function (response) {
if (response['result'] == 'success') {
window.location.reload();
}
}
});
}
else {
alert('RESET 취소됨')
}
};

</script>
</head>

Expand All @@ -148,6 +165,7 @@
<input id="to" type="text" placeholder="TO">
<button onclick="save_node()" type="button">CREATE</button>
<button onclick="delete_node()" type="button">DELETE</button>
<button onclick="reset()" type="button">RESET</button>
<div id="cy"></div>
</body>

Expand Down

0 comments on commit 168064d

Please sign in to comment.