Skip to content

Commit

Permalink
Update iot-gateway js file. (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanpf authored Nov 16, 2023
1 parent 8191f27 commit 6fd16e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions iot-gateway/pjs/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ pipy()
msg => (
(
/// debug = console.log('query config:', msg?.body?.toString?.()),
resp = JSON.decode(msg?.body),
resp = (msg?.body?.toString?.().charAt(0) === '{') && JSON.decode(msg?.body),
) => (
(msg?.head?.status === 401) ? (
deviceConfig.strapiJwt = null,
Expand Down Expand Up @@ -240,7 +240,7 @@ pipy()
.replaceMessage(
msg => (
(
resp = JSON.decode(msg?.body),
resp = (msg?.body?.toString?.().charAt(0) === '{') && JSON.decode(msg?.body),
) => (
(msg?.head?.status === 200 && resp?.data?.id > 0) ? (
[new Message('OK'), new StreamEnd]
Expand Down
2 changes: 1 addition & 1 deletion iot-gateway/pjs/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pipy({
.replaceMessage(
msg => (
msg?.body && (
_dataJson = JSON.decode(msg?.body),
_dataJson = (msg?.body?.toString?.().charAt(0) === '{') && JSON.decode(msg?.body),
(_dataJson?.ts > 0) && (
delete _dataJson.id,
_dataJson.created_at = new Date(_dataJson.ts * 1000).toISOString(),
Expand Down

0 comments on commit 6fd16e2

Please sign in to comment.