From d96dbdd5465bec85b1bb38f38b6b3842adf3784d Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Thu, 11 Jan 2024 13:34:14 +0000 Subject: [PATCH] Only stringify boolean values when setting properties My workaround to the axios bug that makes `false` values not work --- webapp/src/main.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/webapp/src/main.js b/webapp/src/main.js index 7d9fa65e..57da92d3 100644 --- a/webapp/src/main.js +++ b/webapp/src/main.js @@ -63,9 +63,13 @@ Vue.mixin({ "writeproperty", false ); - // NB stringify is needed below, because otherwise boolean - // values get missed. - await axios.put(url, JSON.stringify(value)); + // `false` fails because axios somehow eats it! + // Other values should not be stringified or pydantic + // can't parse them. + if (value===false | value===true) { + value=JSON.stringify(value); + } + await axios.put(url, value); }, thingActionUrl(thing, action) { let url = this.$store.getters["wot/thingActionUrl"](