Hopefully fix the options not always loading
This commit is contained in:
		
							parent
							
								
									9f960a6729
								
							
						
					
					
						commit
						a8a172cbfe
					
				| @ -97,11 +97,8 @@ function _GlidlerAPIAdaptorForGoLangv2<T = unknown>(props: GlidlerAPIAdaptorForG | ||||
|             }); | ||||
|           } | ||||
| 
 | ||||
|           if (props.options && props.options.length > 0) { | ||||
|             const optionHeaders = GoAPIHeaders(props.options); | ||||
|             for (const oh in optionHeaders) { | ||||
|               head.set(oh, optionHeaders[oh]); | ||||
|             } | ||||
|           if ((props.options ?? []).length > 0) { | ||||
|             ops.push(...(props.options ?? [])); | ||||
|           } | ||||
| 
 | ||||
|           const col_ids = | ||||
| @ -189,7 +186,7 @@ function _GlidlerAPIAdaptorForGoLangv2<T = unknown>(props: GlidlerAPIAdaptorForG | ||||
|       props.authtoken, | ||||
|       props.url, | ||||
|       props.filter, | ||||
|       props.options, | ||||
|       JSON.stringify(props.options), | ||||
|       setState, | ||||
|       setStateFN, | ||||
|       addError, | ||||
| @ -203,8 +200,10 @@ function _GlidlerAPIAdaptorForGoLangv2<T = unknown>(props: GlidlerAPIAdaptorForG | ||||
|       //console.log('APIAdaptorGoLangv2', { _active_requests, index, pageSize, props });
 | ||||
|       if (props && props.url) { | ||||
|         const head = new Headers(); | ||||
|         head.set('x-limit', '10'); | ||||
|         head.set('x-fetch-rownumber', String(key)); | ||||
|         const ops: FetchAPIOperation[] = [ | ||||
|           { type: 'limit', value: String(10) }, | ||||
|           { type: 'fetch-rownumber', value: key }, | ||||
|         ]; | ||||
| 
 | ||||
|         head.set('Authorization', `Token ${props.authtoken}`); | ||||
| 
 | ||||
| @ -219,7 +218,11 @@ function _GlidlerAPIAdaptorForGoLangv2<T = unknown>(props: GlidlerAPIAdaptorForG | ||||
|         } | ||||
| 
 | ||||
|         if (props.filter && props.filter !== '') { | ||||
|           head.set('x-custom-sql-w-buildin-filter', props.filter); | ||||
|           ops.push({ | ||||
|             name: 'sql_filter', | ||||
|             type: 'custom-sql-w', | ||||
|             value: props.filter, | ||||
|           }); | ||||
|         } | ||||
| 
 | ||||
|         if (props.options && props.options.length > 0) { | ||||
| @ -229,6 +232,13 @@ function _GlidlerAPIAdaptorForGoLangv2<T = unknown>(props: GlidlerAPIAdaptorForG | ||||
|           } | ||||
|         } | ||||
| 
 | ||||
|         if (ops && ops.length > 0) { | ||||
|           const optionHeaders = GoAPIHeaders(ops); | ||||
|           for (const oh in GoAPIHeaders(ops)) { | ||||
|             head.set(oh, optionHeaders[oh]); | ||||
|           } | ||||
|         } | ||||
| 
 | ||||
|         const controller = new AbortController(); | ||||
| 
 | ||||
|         const res = await fetch(`${props.url}?x-fetch-rownumber=${key}}`, { | ||||
| @ -258,7 +268,7 @@ function _GlidlerAPIAdaptorForGoLangv2<T = unknown>(props: GlidlerAPIAdaptorForG | ||||
|   useEffect(() => { | ||||
|     setState('useAPIQuery', useAPIQuery); | ||||
|     setState('askAPIRowNumber', askAPIRowNumber); | ||||
|   }, [props.url, props.authtoken, props.filter, props.options, mounted, setState]); | ||||
|   }, [props.url, props.authtoken, props.filter, JSON.stringify(props.options), mounted, setState]); | ||||
| 
 | ||||
|   return <></>; | ||||
| } | ||||
|  | ||||
| @ -121,6 +121,7 @@ export const GridlerGoAPIExampleEventlog = () => { | ||||
|       > | ||||
|         <GlidlerAPIAdaptorForGoLangv2 | ||||
|           authtoken={apiKey} | ||||
|           options={[{ type: 'preload', value: 'PRO' }]} | ||||
|           //options={[{ type: 'fieldfilter', name: 'process', value: 'test' }]}
 | ||||
|           url={`${apiUrl}/public/process`} | ||||
|         /> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user