@@ -8,15 +8,21 @@ const props = defineProps<{
88}>()
99
1010const serverUrl = ref (' https://rpc.nimiqwatch.com' )
11- const params = reactive <Record <string , string | boolean >>({})
11+ const textParams = reactive <Record <string , string >>({})
12+ const booleanParams = reactive <Record <string , boolean >>({})
1213const loading = ref (false )
1314const response = ref <any >(null )
1415const error = ref <string | null >(null )
1516
1617watchEffect (() => {
1718 for (const input of props .method .input ) {
18- if (! (input .key in params )) {
19- params [input .key ] = input .type === ' boolean' ? false : ' '
19+ if (input .type === ' boolean' ) {
20+ if (! (input .key in booleanParams )) {
21+ booleanParams [input .key ] = false
22+ }
23+ }
24+ else if (! (input .key in textParams )) {
25+ textParams [input .key ] = ' '
2026 }
2127 }
2228})
@@ -28,14 +34,13 @@ async function callRpc() {
2834
2935 try {
3036 const parsedParams = props .method .input .map ((input ) => {
31- const value = params [input .key ]
3237 if (input .type .includes (' number' )) {
33- return Number (value )
38+ return Number (textParams [ input . key ] )
3439 }
3540 if (input .type === ' boolean' ) {
36- return Boolean ( value )
41+ return booleanParams [ input . key ]
3742 }
38- return value
43+ return textParams [ input . key ]
3944 })
4045
4146 const result = await $fetch (' /api/rpc-proxy' , {
@@ -103,11 +108,11 @@ async function callRpc() {
103108 >
104109 <USwitch
105110 v-if =" input.type === 'boolean'"
106- v-model =" params [input.key]"
111+ v-model =" booleanParams [input.key]"
107112 />
108113 <UInput
109114 v-else
110- v-model =" params [input.key]"
115+ v-model =" textParams [input.key]"
111116 :placeholder =" input.type"
112117 />
113118 </UFormField >
0 commit comments