在App.js中成功注册serviceWorker之后,我的所有API都失败了。
overViewPdfGenerator = async () => {
if ('serviceWorker' in navigator) {
// site using a more restrictive scope.
window.addEventListener('load', function() {
navigator.serviceWorker.register('/ServiceWorker.js', {scope: './'}).then(function(registration) {
console.log('Service worker registration succeeded:', registration);
}, function(error) {
console.log('Service worker registration failed:', error);
});
})
} else {
console.log('Service workers are not supported.');
}
}