- commit
- 0aac555d56b3406b2cbb86ef9f72aa3668623e68
- parent
- a56e4b847580995cc410e7a1b9ab83a3616e5f34
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2022-02-11 06:09
mv response.ok check to _fetch()
Diffstat
| M | dav.js | 18 | +++--------------- |
1 files changed, 3 insertions, 15 deletions
diff --git a/dav.js b/dav.js
@@ -5,7 +5,7 @@ var _fetch = function(url, options) {
5 5 activeRequests += 1;
6 6 networkIndicator.hidden = false;
7 7
8 -1 var p = fetch(url, options);
-1 8 var p = fetch(url, options).then(r => r.ok ? r : Promise.reject(r));
9 9
10 10 p.finally(() => {
11 11 activeRequests -= 1;
@@ -66,13 +66,7 @@ export var getCalendars = function(url) {
66 66 + ' <A:calendar-color xmlns:A="http://apple.com/ns/ical/"/>\n'
67 67 + ' </D:prop>\n'
68 68 + '</D:propfind>',
69 -1 }).then(function(response) {
70 -1 if (response.ok) {
71 -1 return response.text();
72 -1 } else {
73 -1 throw response;
74 -1 }
75 -1 }).then(function(xml) {
-1 69 }).then(r => r.text()).then(function(xml) {
76 70 var parser = new DOMParser();
77 71 var dom = parser.parseFromString(xml, 'text/xml');
78 72 var calendars = [];
@@ -109,13 +103,7 @@ export var getEvents = function(href, info) {
109 103 + ' </L:comp-filter>\n'
110 104 + ' </L:filter>\n'
111 105 + '</L:calendar-query>',
112 -1 }).then(function(response) {
113 -1 if (response.ok) {
114 -1 return response.text();
115 -1 } else {
116 -1 throw response;
117 -1 }
118 -1 }).then(function(xml) {
-1 106 }).then(r => r.text()).then(function(xml) {
119 107 var parser = new DOMParser();
120 108 var dom = parser.parseFromString(xml, 'text/xml');
121 109 var events = [];