Skip to content

Commit 2d1790e

Browse files
committed
No cache to load file frome url
1 parent 0fe8aa4 commit 2d1790e

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

public/js/common.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,25 @@ async function loadFileFromCache(cacheUrl, pageUrl) {
6363
}
6464

6565
async function storeFileInCache(file, filename, cacheStore = 'pdf') {
66-
let cache = await caches.open(cacheStore);
66+
try {
67+
let cache = await caches.open(cacheStore);
68+
} catch(error) {
69+
return;
70+
}
6771
let response = new Response(file, { "status" : 200, "statusText" : "OK" });
6872
await cache.put('/pdf/'+filename, response);
6973
}
7074

7175
async function loadFileFromUrl(url, pageUrl, local = null) {
72-
76+
showLoading('Download')
77+
history.replaceState({}, '', pageUrl);
7378
let headers = new Headers();
7479
if(isDavPath) {
75-
showLoading('Waiting for credentials informations')
7680
let davToken = await requestDavToken();
81+
console.log(davToken);
7782
headers.set('Authorization', 'Basic ' + btoa(davToken));
7883
}
79-
showLoading('Download')
80-
history.replaceState({}, '', pageUrl);
81-
let response = await fetch(url, { headers: headers });
84+
let response = await fetch(url, { headers: headers, cache: "no-cache" });
8285
if(response.status != 200) {
8386
return;
8487
}

0 commit comments

Comments
 (0)