Skip to content

Commit

Permalink
UI: fix that sending message payload false did not work in UI "Send…
Browse files Browse the repository at this point in the history
… Message"

Signed-off-by: Thomas Jäckle <[email protected]>
  • Loading branch information
thjaeckle committed Nov 6, 2023
1 parent ce55fc4 commit bb6444e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion ui/modules/things/featureMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ export async function ready() {
* Calls Ditto to send a message with the parameters of the fields in the UI
*/
function messageFeature() {
const payload = acePayload && acePayload.getValue().length > 0 && JSON.parse(acePayload.getValue());
let payload: any;
if (acePayload && acePayload.getValue().length > 0) {
payload = JSON.parse(acePayload.getValue());
} else {
payload = null;
}
aceResponse.setValue('');
API.callDittoREST('POST', '/things/' + Things.theThing.thingId +
'/features/' + theFeatureId +
Expand Down
7 changes: 6 additions & 1 deletion ui/modules/things/thingMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ export async function ready() {
* Calls Ditto to send a message with the parameters of the fields in the UI
*/
function messageThing() {
const payload = acePayload && acePayload.getValue().length > 0 && JSON.parse(acePayload.getValue());
let payload: any;
if (acePayload && acePayload.getValue().length > 0) {
payload = JSON.parse(acePayload.getValue());
} else {
payload = null;
}
aceResponse.setValue('');
API.callDittoREST('POST', '/things/' + Things.theThing.thingId +
'/inbox/messages/' + dom.inputThingMessageSubject.value +
Expand Down

0 comments on commit bb6444e

Please sign in to comment.