Transfer Panel Details Without an Extra Layer of JSON Encoding (#14)
**Rationale:** This made it harder to snoop on the traffic in the network monitor because it was encoded as a string. **Changes:** - Backend now accepts & provides the panel data as a JSON object rather than as a string - Backend now supports compression - Minor improvements to error handling - Some panel structures were getting saved in the JSON when they weren't supposed to be (now this no longer happens) Reviewed-on: #14 Co-authored-by: Sergey Savelyev <sergeysav.nn@gmail.com> Co-committed-by: Sergey Savelyev <sergeysav.nn@gmail.com>
This commit was merged in pull request #14.
This commit is contained in:
@@ -4,7 +4,7 @@ import { ref } from 'vue';
|
||||
import CommandParameter from '@/components/CommandParameter.vue';
|
||||
import FlexDivider from '@/components/FlexDivider.vue';
|
||||
import type { DynamicDataType } from '@/composables/dynamic.ts';
|
||||
import { toJsonString } from '@/composables/json.ts';
|
||||
import { parseJsonString, toJsonString } from '@/composables/json.ts';
|
||||
|
||||
const props = defineProps<{
|
||||
command: CommandDefinition | null;
|
||||
@@ -30,10 +30,11 @@ async function sendCommand() {
|
||||
},
|
||||
body: toJsonString(params),
|
||||
});
|
||||
const text_response = await response.text();
|
||||
if (response.ok) {
|
||||
result.value = await response.json();
|
||||
result.value = parseJsonString(text_response);
|
||||
} else {
|
||||
result.value = await response.text();
|
||||
result.value = text_response;
|
||||
}
|
||||
busy.value = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user