@@ -63,22 +63,25 @@ async function loadFileFromCache(cacheUrl, pageUrl) {
6363}
6464
6565async 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
7175async 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