From 927c150d457d0c34a721fc6261e6c256fd899843 Mon Sep 17 00:00:00 2001 From: koudenpa Date: Wed, 24 Oct 2018 20:43:04 +0900 Subject: [PATCH] Fix Cancel still submits git commands Ref: https://github.com/high-u/node-red-contrib-git-nodes/issues/1 --- git-nodes.html | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/git-nodes.html b/git-nodes.html index eb729ec..ec8476b 100644 --- a/git-nodes.html +++ b/git-nodes.html @@ -22,18 +22,20 @@ //alert("") var commitMessage = prompt("Input commit message") //alert(commitMessage) - var node = this; - $.ajax({ - url: "git-nodes/"+this.id, - data: { commitMessage: commitMessage }, - type:"post", - success: function(resp) { - RED.notify(node._("git command success",{label:"git"}),"success"); - }, - error: function(jqXHR,textStatus,errorThrown) { - RED.notify(node._("git command error",{label:"git"}),"error"); - } - }); + if (commitMessage) { + var node = this; + $.ajax({ + url: "git-nodes/"+this.id, + data: { commitMessage: commitMessage }, + type:"post", + success: function(resp) { + RED.notify(node._("git command success",{label:"git"}),"success"); + }, + error: function(jqXHR,textStatus,errorThrown) { + RED.notify(node._("git command error",{label:"git"}),"error"); + } + }); + } } } });