@@ -11,6 +11,7 @@ import TextInput from 'components/atoms/common/TextInput';
1111import NodeHorizontalDivider from 'components/atoms/flow/NodeHorizontalDivider' ;
1212import { Listbox , Transition } from '@headlessui/react' ;
1313import { CheckIcon , ChevronUpDownIcon } from '@heroicons/react/20/solid' ;
14+ import requestNodes from '../constants/requestNodes' ;
1415
1516const RequestNode = ( { id, data } ) => {
1617 const setRequestNodeUrl = useCanvasStore ( ( state ) => state . setRequestNodeUrl ) ;
@@ -103,8 +104,6 @@ const RequestNode = ({ id, data }) => {
103104 ) ;
104105 } ;
105106
106- const requestTypes = [ 'GET' , 'PUT' , 'POST' , 'DELETE' ] ;
107-
108107 return (
109108 < FlowNode
110109 title = { data . requestType + ' Request' }
@@ -135,28 +134,30 @@ const RequestNode = ({ id, data }) => {
135134 leaveTo = 'opacity-0'
136135 >
137136 < Listbox . Options className = 'absolute z-50 w-full py-1 mt-1 overflow-auto text-base bg-white max-h-60 focus:outline-none' >
138- { requestTypes . map ( ( reqType ) => (
139- < Listbox . Option
140- key = { reqType }
141- className = { ( { active } ) =>
142- `relative cursor-default select-none py-2 pl-7 pr-4 hover:font-semibold ${
143- active ? 'bg-background-light text-slate-900' : ''
144- } `
145- }
146- value = { reqType }
147- >
148- { ( { selected } ) => (
149- < >
150- < span className = { `block` } > { reqType } </ span >
151- { selected ? (
152- < span className = 'absolute inset-y-0 left-0 flex items-center pl-1 font-semibold' >
153- < CheckIcon className = 'w-5 h-5' aria-hidden = 'true' />
154- </ span >
155- ) : null }
156- </ >
157- ) }
158- </ Listbox . Option >
159- ) ) }
137+ { requestNodes
138+ . map ( ( el ) => el . requestType )
139+ . map ( ( reqType ) => (
140+ < Listbox . Option
141+ key = { reqType }
142+ className = { ( { active } ) =>
143+ `relative cursor-default select-none py-2 pl-7 pr-4 hover:font-semibold ${
144+ active ? 'bg-background-light text-slate-900' : ''
145+ } `
146+ }
147+ value = { reqType }
148+ >
149+ { ( { selected } ) => (
150+ < >
151+ < span className = { `block` } > { reqType } </ span >
152+ { selected ? (
153+ < span className = 'absolute inset-y-0 left-0 flex items-center pl-1 font-semibold' >
154+ < CheckIcon className = 'w-5 h-5' aria-hidden = 'true' />
155+ </ span >
156+ ) : null }
157+ </ >
158+ ) }
159+ </ Listbox . Option >
160+ ) ) }
160161 </ Listbox . Options >
161162 </ Transition >
162163 </ div >
0 commit comments