mirror of https://github.com/Lissy93/dashy.git
✨ Adds option for request timeout in widgets
This commit is contained in:
parent
56798fbdc4
commit
979a776b68
|
@ -476,10 +476,13 @@ export default {
|
||||||
/* Returns users specified widget options, or empty object */
|
/* Returns users specified widget options, or empty object */
|
||||||
widgetOptions() {
|
widgetOptions() {
|
||||||
const options = this.widget.options || {};
|
const options = this.widget.options || {};
|
||||||
|
const timeout = this.widget.timeout || 500;
|
||||||
const useProxy = this.appConfig.widgetsAlwaysUseProxy || !!this.widget.useProxy;
|
const useProxy = this.appConfig.widgetsAlwaysUseProxy || !!this.widget.useProxy;
|
||||||
const updateInterval = this.widget.updateInterval !== undefined
|
const updateInterval = this.widget.updateInterval !== undefined
|
||||||
? this.widget.updateInterval : null;
|
? this.widget.updateInterval : null;
|
||||||
return { useProxy, updateInterval, ...options };
|
return {
|
||||||
|
timeout, useProxy, updateInterval, ...options,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
/* A unique string to reference the widget by */
|
/* A unique string to reference the widget by */
|
||||||
widgetRef() {
|
widgetRef() {
|
||||||
|
|
|
@ -106,8 +106,9 @@ const WidgetMixin = {
|
||||||
const CustomHeaders = options || null;
|
const CustomHeaders = options || null;
|
||||||
const headers = this.useProxy
|
const headers = this.useProxy
|
||||||
? { 'Target-URL': endpoint, CustomHeaders: JSON.stringify(CustomHeaders) } : CustomHeaders;
|
? { 'Target-URL': endpoint, CustomHeaders: JSON.stringify(CustomHeaders) } : CustomHeaders;
|
||||||
|
const timeout = this.options.timeout || 500;
|
||||||
const requestConfig = {
|
const requestConfig = {
|
||||||
method, url, headers, data,
|
method, url, headers, data, timeout,
|
||||||
};
|
};
|
||||||
// Make request
|
// Make request
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
Loading…
Reference in New Issue