Skip to content

Commit 4c47170

Browse files
authored
Merge pull request #9 from FlowFuse/upload-array
Upload array
2 parents e9efc53 + 3bd4bd0 commit 4c47170

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/agent.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,20 @@ class Agent {
157157
if (agent.connected) {
158158
// console.log(`${agent.options.forgeURL}/api/v1/teams/${agent.options.team}/brokers/${agent.options.broker}/topics`)
159159
// console.log(JSON.stringify(agent.topics, null, 2))
160+
const upload = []
161+
Object.keys(agent.topics).forEach((key) => {
162+
upload.push({
163+
topic: key,
164+
type: agent.topics[key].type,
165+
timestamp: agent.topics[key].timestamp
166+
})
167+
})
160168
try {
161169
await got.post(`${agent.options.forgeURL}/api/v1/teams/${agent.options.team}/brokers/${agent.options.broker}/topics`, {
162170
headers: {
163171
Authorization: `Bearer ${this.options.token}`
164172
},
165-
json: agent.topics
173+
json: upload
166174
})
167175
// clear list so only uploading new topics each time
168176
agent.topics = {}

0 commit comments

Comments
 (0)