@@ -64,9 +64,9 @@ const paramNames = computed(() => parsedRoute.value?.filter(i => i.startsWith(':
6464const routeMethod = ref (props .route .method || ' GET' )
6565const routeParams = ref <{ [key : string ]: string }>({})
6666const routeInputs = reactive ({
67- query: [{ key: ' ' , value: ' ' , type: ' string' }] as ServerRouteInput [],
68- body: [{ key: ' ' , value: ' ' , type: ' string' }] as ServerRouteInput [],
69- headers: [{ key: ' Content-Type' , value: ' application/json' , type: ' string' }] as ServerRouteInput [],
67+ query: [{ active: true , key: ' ' , value: ' ' , type: ' string' }] as ServerRouteInput [],
68+ body: [{ active: true , key: ' ' , value: ' ' , type: ' string' }] as ServerRouteInput [],
69+ headers: [{ active: true , key: ' Content-Type' , value: ' application/json' , type: ' string' }] as ServerRouteInput [],
7070})
7171const routeInputBodyJSON = ref ({})
7272const {
@@ -151,9 +151,9 @@ const finalPath = computed(() => {
151151})
152152const finalURL = computed (() => domain .value + finalPath .value )
153153
154- function parseInputs(inputs : any []) {
154+ function parseInputs(inputs : ServerRouteInput []) {
155155 const formatted = Object .fromEntries (
156- inputs .filter (({ key , value }) => key && value !== undefined ).map (({ key , value }) => [key , value ]),
156+ inputs .filter (({ active , key , value }) => active && key && value !== undefined ).map (({ key , value }) => [key , value ]),
157157 )
158158 return Object .entries (formatted ).length ? formatted : undefined
159159}
@@ -236,6 +236,9 @@ ${items.join(',\n').split('\n').map(line => ` ${line}`).join('\n')}
236236 return snippets
237237})
238238
239+ const cookies = ref (getCookies ())
240+ const newCookie = reactive ({ key: ' ' , value: ' ' })
241+
239242const tabs = computed (() => {
240243 const items = []
241244 if (paramNames .value .length ) {
@@ -265,6 +268,7 @@ const tabs = computed(() => {
265268 items .push ({
266269 name: ' Cookies' ,
267270 slug: ' cookies' ,
271+ length: cookies .value .length ,
268272 })
269273 items .push ({
270274 name: ' Snippets' ,
@@ -273,17 +277,13 @@ const tabs = computed(() => {
273277 return items
274278})
275279
276- const cookies = ref (getCookies ())
277-
278280function getCookies() {
279281 return document .cookie .split (' ; ' ).map ((i ) => {
280282 const [key, value] = i .split (' =' )
281283 return { key , value }
282- })
284+ }). filter ( i => i . key )
283285}
284286
285- const newCookie = reactive ({ key: ' ' , value: ' ' })
286-
287287function updateCookie(key : string , value : any ) {
288288 if (! key )
289289 return
@@ -359,7 +359,7 @@ const copy = useCopy()
359359 />
360360 </div >
361361 </div >
362- <NButton n =" primary solid" @click =" fetchData" >
362+ <NButton h-full n =" primary solid" @click =" fetchData" >
363363 <NIcon icon =" carbon:send" />
364364 </NButton >
365365 </div >
@@ -429,7 +429,7 @@ const copy = useCopy()
429429 @input =" updateCookie(cookie.key, $event.target?.value)"
430430 />
431431 <NButton title =" Delete" n =" red" @click =" updateCookie(cookie.key, undefined)" >
432- <NIcon icon =" i-carbon-delete " />
432+ <NIcon icon =" i-carbon-trash-can " />
433433 </NButton >
434434 </div >
435435 <div flex =" ~ gap-4" >
@@ -449,7 +449,7 @@ const copy = useCopy()
449449 </div >
450450 </div >
451451 <DefineDefaultInputs >
452- <ServerRouteInputs v-model =" currentParams" :default =" { type: 'string' }" max-h-xs of-auto >
452+ <ServerRouteInputs v-model =" currentParams" :default =" { active: true, type: 'string' }" max-h-xs of-auto >
453453 <template v-if =" inputDefaults [activeTab ]?.length " >
454454 <div flex =" ~ gap2" mb--2 items-center op50 >
455455 <div w-5 x-divider />
0 commit comments