Commit debe182 1 parent cceb442 commit debe182 Copy full SHA for debe182
File tree 1 file changed +22
-9
lines changed
bundles/org.openhab.ui/web/src/js/openhab
1 file changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,28 @@ export default {
30
30
get ( uri , data ) {
31
31
return wrapPromise ( Framework7 . request . promise . json ( uri , data ) )
32
32
} ,
33
- getPlain ( uri , data , contentType , responseType ) {
34
- return wrapPromise ( Framework7 . request . promise ( {
35
- method : 'GET' ,
36
- url : uri ,
37
- data,
38
- processData : false ,
39
- contentType : contentType || 'text/plain' ,
40
- xhrFields : typeof responseType !== 'undefined' ? { responseType } : null
41
- } ) )
33
+ getPlain ( uri_or_parameters , data , contentType , responseType ) {
34
+ let parameters = { }
35
+ if ( typeof uri_or_parameters === 'string' ) {
36
+ parameters = {
37
+ url : uri_or_parameters ,
38
+ method : 'GET' ,
39
+ data,
40
+ processData : false ,
41
+ contentType : contentType || 'text/plain' ,
42
+ xhrFields : typeof responseType !== 'undefined' ? { responseType } : null
43
+ }
44
+ } else if ( typeof uri_or_parameters === 'object' ) {
45
+ parameters = {
46
+ contentType : 'text/plain' ,
47
+ processData : false ,
48
+ method : 'GET' ,
49
+ ...uri_or_parameters
50
+ }
51
+ } else {
52
+ throw new Error ( 'Invalid parameters' )
53
+ }
54
+ return wrapPromise ( Framework7 . request . promise ( parameters ) )
42
55
} ,
43
56
post ( uri , data , dataType ) {
44
57
return wrapPromise ( Framework7 . request . promise . postJSON ( uri , data , dataType ) )
You can’t perform that action at this time.
0 commit comments