File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -59,11 +59,18 @@ self.addEventListener("fetch", (e) => {
5959
6060 // Otherwise, fetch from network
6161 const response = await fetch ( e . request ) ;
62- const cache = await caches . open ( cacheName ) ;
63- console . log ( `[Service Worker] Caching new resource: ${ e . request . url } ` ) ;
64- if ( e . request . method !== "POST" ) {
62+
63+ if (
64+ e . request . method !== "POST" &&
65+ // Authorization requests should not be cached
66+ ! / h t t p s : \/ \/ .* ?\. d y n a m s o f t .c o m \/ a u t h / . test ( e . request . url )
67+ // You can add other filter conditions
68+ ) {
69+ const cache = await caches . open ( cacheName ) ;
70+ console . log ( `[Service Worker] Caching new resource: ${ e . request . url } ` ) ;
6571 cache . put ( e . request , response . clone ( ) ) ;
6672 }
73+
6774 return response ;
6875 } ) ( )
6976 ) ;
You can’t perform that action at this time.
0 commit comments