pkey is array

This commit is contained in:
nacho 2025-08-07 16:55:11 -03:00
parent 7acb8d9303
commit d676884ae8
Signed by: nacho
SSH key fingerprint: SHA256:vijZwyV/ggB5iBXxEFr5kvag8tn7s4s8vrPFf9cFKjY
2 changed files with 2 additions and 2 deletions

View file

@ -11,7 +11,7 @@
}, },
inputs: 1, inputs: 1,
outputs: 1, outputs: 1,
icon: "font-awesome/fa-rotate", icon: "font-awesome/fa-table",
label: function () { label: function () {
return this.tableId ? `[Sync] ${this.tableId}` : "Sync table"; return this.tableId ? `[Sync] ${this.tableId}` : "Sync table";
}, },

View file

@ -15,7 +15,7 @@ module.exports = function (RED) {
const api = new GristDocAPI(this.document.docid, { apiKey: this.server.apiKey, server: url }); const api = new GristDocAPI(this.document.docid, { apiKey: this.server.apiKey, server: url });
const data = Array.isArray(msg.payload) ? msg.payload : [msg.payload] const data = Array.isArray(msg.payload) ? msg.payload : [msg.payload]
api.syncTable(this.table, data, this.primaryKey).then(data => { api.syncTable(this.table, data, [this.primaryKey]).then(data => {
node.send({ ...msg, payload: data }) node.send({ ...msg, payload: data })
}).catch(reason => done(reason, "Failed to perform grist request to " + url)); }).catch(reason => done(reason, "Failed to perform grist request to " + url));