bugfix/API Explorer II should report JSON error in case of a JSON error

This commit is contained in:
Marko Milić 2024-02-27 16:17:00 +01:00
parent 1efc0beced
commit 1dc7c030f6
2 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "api-explorer",
"version": "1.0.13",
"version": "1.0.14",
"private": true,
"scripts": {
"dev": "vite & ts-node server/app.ts",

View File

@ -126,7 +126,9 @@ const submit = async (form: FormInstance, fn: () => void) => {
fn(form).then(() => {})
}
const highlightCode = (json) => {
if (json) {
if (json.error) {
successResponseBody.value = json.error.message
} else if (json) {
successResponseBody.value = hljs.lineNumbersValue(
hljs.highlightAuto(JSON.stringify(json, null, 4), ['JSON']).value
)