@@ -48,6 +48,7 @@ const ReactiveBase = {
4848 mongodb : types . mongodb ,
4949 endpoint : types . endpointConfig ,
5050 preferences : VueTypes . object ,
51+ httpRequestTimeout : types . number ,
5152 } ,
5253 provide ( ) {
5354 let createCacheFn = createCache ;
@@ -94,6 +95,9 @@ const ReactiveBase = {
9495 mongodb ( ) {
9596 this . updateState ( this . $props ) ;
9697 } ,
98+ httpRequestTimeout ( ) {
99+ this . updateState ( this . $props ) ;
100+ } ,
97101 } ,
98102 computed : {
99103 getHeaders ( ) {
@@ -105,10 +109,10 @@ const ReactiveBase = {
105109 ...( enableTelemetry === false && { 'X-Enable-Telemetry' : false } ) ,
106110 } ) ,
107111 ...headers ,
108- ...( endpoint
109- && endpoint . headers && {
110- ...endpoint . headers ,
111- } ) ,
112+ ...( endpoint &&
113+ endpoint . headers && {
114+ ...endpoint . headers ,
115+ } ) ,
112116 } ;
113117 } ,
114118 } ,
@@ -118,8 +122,8 @@ const ReactiveBase = {
118122 this . key = `${ this . state . key } -0` ;
119123 } ,
120124 setStore ( props ) {
121- const credentials
122- = props . url && props . url . trim ( ) !== '' && ! props . credentials
125+ const credentials =
126+ props . url && props . url . trim ( ) !== '' && ! props . credentials
123127 ? null
124128 : props . credentials ;
125129 let url = props . url && props . url . trim ( ) !== '' ? props . url : '' ;
@@ -147,6 +151,7 @@ const ReactiveBase = {
147151 analyticsConfig : props . reactivesearchAPIConfig ,
148152 mongodb : props . mongodb ,
149153 endpoint : props . endpoint ,
154+ httpRequestTimeout : props . httpRequestTimeout || 30000 ,
150155 } ;
151156 let queryParams = '' ;
152157
@@ -203,8 +208,8 @@ const ReactiveBase = {
203208 // When endpoint prop is used index is not defined, so we use _default
204209 index : appbaseRef . app || '_default' ,
205210 globalCustomEvents :
206- this . $props . reactivesearchAPIConfig
207- && this . $props . reactivesearchAPIConfig . customEvents ,
211+ this . $props . reactivesearchAPIConfig &&
212+ this . $props . reactivesearchAPIConfig . customEvents ,
208213 } ;
209214
210215 try {
@@ -214,13 +219,13 @@ const ReactiveBase = {
214219 / \/ \/ ( .* ?) \/ .* / ,
215220 '//$1' ,
216221 ) ;
217- const headerCredentials
218- = this . $props . endpoint . headers && this . $props . endpoint . headers . Authorization ;
219- analyticsInitConfig . credentials
220- = headerCredentials && headerCredentials . replace ( 'Basic ' , '' ) ;
222+ const headerCredentials =
223+ this . $props . endpoint . headers && this . $props . endpoint . headers . Authorization ;
224+ analyticsInitConfig . credentials =
225+ headerCredentials && headerCredentials . replace ( 'Basic ' , '' ) ;
221226 // Decode the credentials
222- analyticsInitConfig . credentials
223- = analyticsInitConfig . credentials && atob ( analyticsInitConfig . credentials ) ;
227+ analyticsInitConfig . credentials =
228+ analyticsInitConfig . credentials && atob ( analyticsInitConfig . credentials ) ;
224229 }
225230 } catch ( e ) {
226231 console . error ( 'Endpoint not set correctly for analytics' ) ;
0 commit comments