Skip to content

Commit

Permalink
minor ui updates and type fix
Browse files Browse the repository at this point in the history
* fix StringInspector prompts
* wrap PHP>JSON conversion in try/catch so we don't clog up the console
* use vue-json-pretty types
  • Loading branch information
JStruk committed Jan 24, 2024
1 parent d3710a0 commit 1815c4f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/views/FormatJSON.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ import 'vue-json-pretty/lib/styles.css'
import copyIcon from '../assets/copy-icon.png'
import { toast } from 'vue3-toastify'
import TwoPaneLayout from '../Layouts/TwoPaneLayout.vue'
import type { JSONDataType } from 'vue-json-pretty/types/utils'
let JSONInput = ref<string>('{}')
const isJSONValid = ref<boolean>(true)
const formattedJSON = ref<Object>({})
const formattedJSON = ref<JSONDataType>({})
function formatJSON() {
JSONInput.value.replace(/'/g, '"')
Expand Down
4 changes: 3 additions & 1 deletion src/views/PHPArrayToJSON.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const PHPArray = ref<string>('')
const json = ref()
function convert() {
json.value = PHPArrayToJSON(PHPArray.value)
try {
json.value = PHPArrayToJSON(PHPArray.value)
} catch (e) {}

Check failure on line 41 in src/views/PHPArrayToJSON.vue

View workflow job for this annotation

GitHub Actions / build (18.x)

Empty block statement
}
</script>
3 changes: 1 addition & 2 deletions src/views/StringInspector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
<TwoPaneLayout>
<template v-slot:left-pane>
<div class="flex-1 rounded-lg p-2 min-h-1/2 h-full overflow-auto">
<span>Enter JSON Data:</span>
<span>Enter String:</span>
<textarea
rows=40
v-model="inputText"
@input="inspectText"
type="text"
placeholder="JSON Data"
aria-label="string-inspector"
class="w-full border border-gray-400 rounded-lg p-2"
/>
Expand Down

0 comments on commit 1815c4f

Please sign in to comment.