mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
update What3Words node to latest library
and fix credentials issue closes #285
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
|
||||
<script type="text/x-red" data-template-name="what3words">
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-pushkey"><i class="fa fa-key"></i> API Key</label>
|
||||
<input type="password" id="node-config-input-pushkey">
|
||||
<label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label>
|
||||
<input type="password" id="node-input-apikey">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-lang"><i class="fa fa-language"></i> Language</label>
|
||||
@@ -45,6 +45,9 @@
|
||||
lang: {value:"en"},
|
||||
name: {value:""}
|
||||
},
|
||||
credentials: {
|
||||
apikey: {type: "password"}
|
||||
},
|
||||
color:"#DEBD5C",
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
@@ -54,35 +57,6 @@
|
||||
},
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
},
|
||||
oneditprepare: function() {
|
||||
$.getJSON('nma/'+this.id,function(data) {
|
||||
if (data.hasPassword) {
|
||||
$('#node-config-input-pushkey').val('__PWRD__');
|
||||
} else {
|
||||
$('#node-config-input-pushkey').val('');
|
||||
}
|
||||
});
|
||||
},
|
||||
oneditsave: function() {
|
||||
var credentials = {};
|
||||
var newPass = $('#node-config-input-pushkey').val();
|
||||
if (newPass != '__PWRD__') {
|
||||
credentials.pushkey = newPass;
|
||||
$.ajax({
|
||||
url: 'nma/'+this.id,
|
||||
type: 'POST',
|
||||
data: credentials,
|
||||
success: function(result){}
|
||||
});
|
||||
}
|
||||
},
|
||||
ondelete: function() {
|
||||
$.ajax({
|
||||
url: 'nma/'+this.id,
|
||||
type: 'DELETE',
|
||||
success: function(result) {}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user