Skip to content

Commit a46b2bf

Browse files
feat(vue): add httpRequestTimeout prop to reactivebase
1 parent c3a01ea commit a46b2bf

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

packages/vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@appbaseio/vue-emotion": "0.6.0-alpha.6",
4040
"@emotion/css": "^11.10.5",
4141
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
42-
"appbase-js": "^5.2.0",
42+
"appbase-js": "^5.3.3",
4343
"compute-scroll-into-view": "^1.0.11",
4444
"emotion": "11.0.0",
4545
"hotkeys-js": "^3.8.7",

packages/vue/src/components/ReactiveBase/index.jsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)